π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
[mobile][photos] Skip local reads for system trash files
Priyanshu Dangare0f8a8fc0da3d
diff --git a/mobile/apps/photos/lib/module/download/file.dart b/mobile/apps/photos/lib/module/download/file.dartindex 7d9694292d..da5bf710b4 100644--- a/mobile/apps/photos/lib/module/download/file.dart+++ b/mobile/apps/photos/lib/module/download/file.dart@@ -77,27 +77,32 @@ Future<File?> _getLocalDiskFile(EnteFile file, {bool liveVideo = false,bool isOrigin = false,-}) {+}) async {+ // Return null because reading a system trash file by its file system path+ // fails with a permission-denied error.+ if (file.isSystemOnlyTrashFile) {+ return null;+ }+if (file.isSharedMediaToAppSandbox) {final localFile = File(getSharedMediaPathFromLocalID(file.localID!));- return localFile.exists().then((exist) {- return exist ? localFile : null;- });- } else if (file.fileType == FileType.livePhoto && liveVideo) {- return Motionphoto.getLivePhotoFile(file.localID!);- } else {- return file.getAsset.then((asset) async {- if (asset == null || !(await asset.exists)) {- if (isOrigin && file.isVideo) {- _logger.warning(- "Failed to get file for assetID: ${file.localID}, is asset null: ${asset == null}",- );- }- return null;- }- return isOrigin ? asset.originFile : asset.file;- });+ return await localFile.exists() ? localFile : null;+ }++ if (file.fileType == FileType.livePhoto && liveVideo) {+ return await Motionphoto.getLivePhotoFile(file.localID!);+ }++ final asset = await file.getAsset;+ if (asset == null || !(await asset.exists)) {+ if (isOrigin && file.isVideo) {+ _logger.warning(+ "Failed to get file for assetID: ${file.localID}, is asset null: ${asset == null}",+ );+ }+ return null;}+ return isOrigin ? await asset.originFile : await asset.file;}String getSharedMediaFilePath(EnteFile file) {