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

* Handle empty original filename

* Handle TypeError from photo_manager titleAsync

* More compact exception log
This commit is contained in:
Sergey Katsubo
2025-11-04 06:09:18 +03:00
committed by GitHub
parent b8087b4fa2
commit 0647c22956

View File

@@ -89,9 +89,16 @@ class AssetMediaRepository {
return null; return null;
} }
// titleAsync gets the correct original filename for some assets on iOS try {
// otherwise using the `entity.title` would return a random GUID // titleAsync gets the correct original filename for some assets on iOS
return await entity.titleAsync; // 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 // TODO: make this more efficient