diff --git a/src/app/features/albums/AlbumView.tsx b/src/app/features/albums/AlbumView.tsx index 20c1e27c..e60f9533 100644 --- a/src/app/features/albums/AlbumView.tsx +++ b/src/app/features/albums/AlbumView.tsx @@ -131,7 +131,7 @@ export function AlbumView({ room, onTimeline }: AlbumViewProps) { ); } else if (encrypted) body = This zone is encrypted, so its albums cannot be listed here.; - else if (albums.length === 0) body = No albums yet.; + else if (albums.length === 0 && path.length === 0) body = No albums yet.; else { const here = listFolder(albums, path); body = ( diff --git a/src/app/features/albums/albumFolders.test.ts b/src/app/features/albums/albumFolders.test.ts index 4d896604..9a9be53e 100644 --- a/src/app/features/albums/albumFolders.test.ts +++ b/src/app/features/albums/albumFolders.test.ts @@ -69,6 +69,10 @@ describe('listFolder', () => { const odd = [album('$u', '///')]; expect(names(listFolder(odd, []))).toEqual({ folders: [], albums: ['$u=///'] }); expect(names(listFolder(odd, ['x']))).toEqual({ folders: [], albums: [] }); + expect(names(listFolder([album('$w', ' ')], []))).toEqual({ + folders: [], + albums: ['$w=Untitled album'], + }); }); it('server-supplied names like "constructor" are folders, not prototype hits', () => { diff --git a/src/app/features/albums/albumFolders.ts b/src/app/features/albums/albumFolders.ts index 18424fe4..a74d363f 100644 --- a/src/app/features/albums/albumFolders.ts +++ b/src/app/features/albums/albumFolders.ts @@ -1,6 +1,6 @@ // Pure: folders are albums whose title is a `/`-separated path (docs/commons-files-desk.md, "Folders"). // No wire change: the album is still one thread root; the folder tree is only how the list is grouped. -import { Album } from './buildAlbums'; +import { Album, UNTITLED } from './buildAlbums'; /** A path as segments. Empty segments and surrounding space drop out; `.` and `..` are ordinary names, never navigation. */ export const splitPath = (title: string): string[] => @@ -36,7 +36,7 @@ export const listFolder = (albums: readonly Album[], at: string[]): FolderListin const segs = splitPath(album.title); if (segs.length === 0) { // An untitled or all-slash title lives at the root under the title as written. - if (at.length === 0) direct.push({ album, leaf: album.title }); + if (at.length === 0) direct.push({ album, leaf: album.title.trim() || UNTITLED }); return; } if (!startsWith(segs, at)) return;