From fb9defb1310c505df6ef2546d44b6a02f290d3ff Mon Sep 17 00:00:00 2001 From: Thibault Deckers Date: Tue, 13 Apr 2021 13:27:47 +0900 Subject: [PATCH] fixed album auto naming for folders on SD card --- lib/model/source/album.dart | 2 +- test/model/collection_source_test.dart | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/model/source/album.dart b/lib/model/source/album.dart index cbb8d1305..72e2930e5 100644 --- a/lib/model/source/album.dart +++ b/lib/model/source/album.dart @@ -56,7 +56,7 @@ mixin AlbumMixin on SourceBase { final otherAlbumsOnDevice = _directories.where((item) => item != dirPath).toSet(); final uniqueNameInDevice = unique(dirPath, otherAlbumsOnDevice); - if (uniqueNameInDevice.length < relativeDir.length) { + if (uniqueNameInDevice.length <= relativeDir.length) { return uniqueNameInDevice; } diff --git a/test/model/collection_source_test.dart b/test/model/collection_source_test.dart index 18fba037d..874a128f1 100644 --- a/test/model/collection_source_test.dart +++ b/test/model/collection_source_test.dart @@ -254,6 +254,8 @@ void main() { FakeMediaStoreService.newImage('${FakeStorageService.primaryPath}', '1'), FakeMediaStoreService.newImage('${FakeStorageService.primaryPath}Pictures/Seneca', '1'), FakeMediaStoreService.newImage('${FakeStorageService.primaryPath}Seneca', '1'), + FakeMediaStoreService.newImage('${FakeStorageService.removablePath}Pictures/Cicero', '1'), + FakeMediaStoreService.newImage('${FakeStorageService.removablePath}Marcus Aurelius', '1'), }; await androidFileUtils.init(); @@ -269,6 +271,8 @@ void main() { expect(source.getAlbumDisplayName(context, FakeStorageService.primaryRootAlbum), FakeStorageService.primaryDescription); expect(source.getAlbumDisplayName(context, '${FakeStorageService.primaryPath}Pictures/Seneca'), 'Pictures/Seneca'); expect(source.getAlbumDisplayName(context, '${FakeStorageService.primaryPath}Seneca'), 'Seneca'); + expect(source.getAlbumDisplayName(context, '${FakeStorageService.removablePath}Pictures/Cicero'), 'Cicero'); + expect(source.getAlbumDisplayName(context, '${FakeStorageService.removablePath}Marcus Aurelius'), 'Marcus Aurelius'); return Placeholder(); }, ),