diff --git a/app/lib/entity/collection/builder.dart b/app/lib/entity/collection/builder.dart index 403fa313..e1805ab5 100644 --- a/app/lib/entity/collection/builder.dart +++ b/app/lib/entity/collection/builder.dart @@ -34,7 +34,7 @@ class CollectionBuilder { static Collection byNcAlbum(Account account, NcAlbum album) { return Collection( - name: album.strippedPath, + name: album.name, contentProvider: CollectionNcAlbumProvider( account: account, album: album, diff --git a/app/lib/entity/nc_album.dart b/app/lib/entity/nc_album.dart index da08aed7..c3d5f773 100644 --- a/app/lib/entity/nc_album.dart +++ b/app/lib/entity/nc_album.dart @@ -75,6 +75,24 @@ extension NcAlbumExtension on NcAlbum { return p.startsWith("albums/"); } + /// Return the name of this album + /// + /// Normally this is identical to [strippedPath], except for those shared by + /// others + String get name { + if (isOwned) { + return strippedPath; + } + final p = strippedPath; + final found = p.lastIndexOf(" ("); + if (found == -1) { + // ? + return p; + } else { + return p.slice(0, found); + } + } + /// Return the path of this file with the DAV part stripped /// /// WebDAV file path: remote.php/dav/photos/{userId}/albums/{strippedPath}.