Skip to content

High performance self-hosted photo and video management solution.

fix(mobile): Prefer sharing local assets to remote (#7245)

martyfuhrye338e4def699
diff --git a/mobile/lib/shared/services/share.service.dart b/mobile/lib/shared/services/share.service.dart
index 20ee40d588..d7daa51b86 100644
--- a/mobile/lib/shared/services/share.service.dart
+++ b/mobile/lib/shared/services/share.service.dart
@@ -27,7 +27,12 @@ class ShareService {
final downloadedXFiles = <XFile>[];
for (var asset in assets) {
- if (asset.isRemote) {
+ if (asset.isLocal) {
+ // Prefer local assets to share
+ File? f = await asset.local!.file;
+ downloadedXFiles.add(XFile(f!.path));
+ } else if (asset.isRemote) {
+ // Download remote asset otherwise
final tempDir = await getTemporaryDirectory();
final fileName = asset.fileName;
final tempFile = await File('${tempDir.path}/$fileName').create();
@@ -43,9 +48,6 @@ class ShareService {
tempFile.writeAsBytesSync(res.bodyBytes);
downloadedXFiles.add(XFile(tempFile.path));
- } else {
- File? f = await asset.local!.file;
- downloadedXFiles.add(XFile(f!.path));
}
}