Skip to content

High performance self-hosted photo and video management solution.

fix(mobile): handle empty original filename (#23469)

Sergey Katsubo0647c22956d4
diff --git a/mobile/lib/repositories/asset_media.repository.dart b/mobile/lib/repositories/asset_media.repository.dart
index e377ff22d6..2e4bdfd32c 100644
--- a/mobile/lib/repositories/asset_media.repository.dart
+++ b/mobile/lib/repositories/asset_media.repository.dart
@@ -89,9 +89,16 @@ class AssetMediaRepository {
return null;
}
- // titleAsync gets the correct original filename for some assets on iOS
- // otherwise using the `entity.title` would return a random GUID
- return await entity.titleAsync;
+ try {
+ // titleAsync gets the correct original filename for some assets on iOS
+ // otherwise using the `entity.title` would return a random GUID
+ final originalFilename = await entity.titleAsync;
+ // treat empty filename as missing
+ return originalFilename.isNotEmpty ? originalFilename : null;
+ } catch (e) {
+ _log.warning("Failed to get original filename for asset: $id. Error: $e");
+ return null;
+ }
}
// TODO: make this more efficient