π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
[mobile][photos] Fix extensionless gallery downloads
laurenspriem886bfe0ad29c
diff --git a/mobile/apps/photos/changes/android-gallery-extensionless-download.md b/mobile/apps/photos/changes/android-gallery-extensionless-download.mdnew file mode 100644index 0000000000..4c4eb8853f--- /dev/null+++ b/mobile/apps/photos/changes/android-gallery-extensionless-download.md@@ -0,0 +1 @@+- Fixed downloading images without file extensions to the Android gallery.diff --git a/mobile/apps/photos/lib/module/download/file.dart b/mobile/apps/photos/lib/module/download/file.dartindex e229448afe..1bc73c01db 100644--- a/mobile/apps/photos/lib/module/download/file.dart+++ b/mobile/apps/photos/lib/module/download/file.dart@@ -262,7 +262,7 @@ Future<File?> _downloadAndCache(return null;}final decryptedFilePath = decryptedFile.path;- final String fileExtension = getExtension(file.title ?? '');+ String fileExtension = getExtension(file.title ?? '');File outputFile = decryptedFile;if ((fileExtension == "unknown" && file.fileType == FileType.image)) {final compressResult = await FlutterImageCompress.compressAndGetFile(@@ -274,6 +274,7 @@ Future<File?> _downloadAndCache(throw Exception("Failed to convert heic to jpg");} else {outputFile = File(compressResult.path);+ fileExtension = "jpg";}await decryptedFile.delete();}diff --git a/mobile/apps/photos/lib/module/download/gallery.dart b/mobile/apps/photos/lib/module/download/gallery.dartindex 1c0d8186c3..356c797ddb 100644--- a/mobile/apps/photos/lib/module/download/gallery.dart+++ b/mobile/apps/photos/lib/module/download/gallery.dart@@ -30,14 +30,17 @@ String getDownloadSkipToastFileName(EnteFile file) {String _getGallerySaveTitle(EnteFile file, String fallbackPath) {final displayName = file.displayName;- if (displayName.trim().isNotEmpty) {- return displayName;+ final title = displayName.trim().isNotEmpty+ ? displayName+ : ((file.title != null && file.title!.trim().isNotEmpty)+ ? file.title!+ : file_path.basename(fallbackPath));+ if (file.fileType == FileType.image &&+ file_path.extension(title).isEmpty &&+ file_path.extension(fallbackPath).toLowerCase() == ".unknown") {+ return "$title.jpg";}- final title = file.title;- if (title != null && title.trim().isNotEmpty) {- return title;- }- return file_path.basename(fallbackPath);+ return title;}Future<String?> getExistingLocalFolderNameForDownloadSkipToast(