π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
Simplify 2
Manav Rathi17648c582a62
diff --git a/web/apps/photos/src/services/upload-manager.ts b/web/apps/photos/src/services/upload-manager.tsindex 629ce4db1b..46564076a9 100644--- a/web/apps/photos/src/services/upload-manager.ts+++ b/web/apps/photos/src/services/upload-manager.ts@@ -540,52 +540,33 @@ class UploadManager {): Promise<FinishedUploadType> {const type = uploadResult.type;log.info(`Upload ${uploadableItem.fileName} | ${type}`);-try {const processableUploadItem =await markUploadedAndObtainProcessableItem(uploadableItem);- let decryptedFile: EnteFile;switch (uploadResult.type) {case "failed":case "blocked":- // Retriable.+ // Retriable error.this.failedItems.push(uploadableItem);break;- case "alreadyUploaded":+case "addedSymlink":- decryptedFile = uploadResult.file;+ this.updateExistingFiles(uploadResult.file);break;+case "uploaded":case "uploadedWithStaticThumbnail":- decryptedFile = uploadResult.file;- break;- case "largerThanAvailableStorage":- case "unsupported":- case "tooLarge":- // no-op+ {+ const { file } = uploadResult;++ indexNewUpload(file, processableUploadItem);+ processVideoNewUpload(file, processableUploadItem);++ this.updateExistingFiles(file);+ }break;}- if (- [- "addedSymlink",- "uploaded",- "uploadedWithStaticThumbnail",- ].includes(type)- ) {- const uploadItem =- uploadableItem.uploadItem ??- uploadableItem.livePhotoAssets.image;- if (- uploadItem &&- (type == "uploaded" ||- type == "uploadedWithStaticThumbnail")- ) {- indexNewUpload(decryptedFile, processableUploadItem);- processVideoNewUpload(decryptedFile, processableUploadItem);- }- this.updateExistingFiles(decryptedFile);- }if (isDesktop && watcher.isUploadRunning()) {await watcher.onFileUpload(uploadableItem, uploadResult);@@ -620,12 +601,9 @@ class UploadManager {return this.uploaderName;}- private updateExistingFiles(decryptedFile: EnteFile) {- if (!decryptedFile) {- throw Error("decrypted file can't be undefined");- }- this.existingFiles.push(decryptedFile);- this.onUploadFile(decryptedFile);+ private updateExistingFiles(file: EnteFile) {+ this.existingFiles.push(file);+ this.onUploadFile(file);}/**diff --git a/web/packages/gallery/services/upload/index.ts b/web/packages/gallery/services/upload/index.tsindex 7020f0e816..da3d7891d2 100644--- a/web/packages/gallery/services/upload/index.ts+++ b/web/packages/gallery/services/upload/index.ts@@ -279,8 +279,8 @@ export type UploadableUploadItem = ClusteredUploadItem & {};/**- * Result of {@link markUploadedAndObtainPostProcessableItem}; see the- * documentation of that function for the meaning and cases of this type.+ * Result of {@link markUploadedAndObtainProcessableItem}; see the documentation+ * of that function for the meaning and cases of this type.*/export type ProcessableUploadItem = File | TimestampedFileSystemUploadItem;