diff --git a/CHANGELOG.md b/CHANGELOG.md index 10e0f4462..5cc4886e9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ All notable changes to this project will be documented in this file. ### Fixed - crash when cataloguing some videos +- workflow when moving to an album with insufficient storage ## [v1.9.4] - 2023-09-13 diff --git a/lib/widgets/common/action_mixins/entry_storage.dart b/lib/widgets/common/action_mixins/entry_storage.dart index 171d3341f..3cb84cb70 100644 --- a/lib/widgets/common/action_mixins/entry_storage.dart +++ b/lib/widgets/common/action_mixins/entry_storage.dart @@ -154,9 +154,10 @@ mixin EntryStorageMixin on FeedbackMixin, PermissionAwareMixin, SizeAwareMixin { final originAlbums = entries.map((e) => e.directory).whereNotNull().toSet(); if ({MoveType.move, MoveType.toBin}.contains(moveType) && !await checkStoragePermissionForAlbums(context, originAlbums, entries: entries)) return; - await Future.forEach(destinationAlbums, (destinationAlbum) async { - if (!await checkFreeSpaceForMove(context, entries, destinationAlbum, moveType)) return; - }); + final hasEnoughSpaceByDestination = await Future.wait(destinationAlbums.map((destinationAlbum) { + return checkFreeSpaceForMove(context, entries, destinationAlbum, moveType); + })); + if (hasEnoughSpaceByDestination.any((v) => !v)) return; final l10n = context.l10n; var nameConflictStrategy = NameConflictStrategy.rename;