π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
custom
Manav Rathi24c7b49132d4
diff --git a/web/packages/gallery/services/upload/remote.ts b/web/packages/gallery/services/upload/remote.tsindex 063511d224..935bfab9fe 100644--- a/web/packages/gallery/services/upload/remote.ts+++ b/web/packages/gallery/services/upload/remote.ts@@ -20,6 +20,38 @@ import { nullToUndefined } from "ente-utils/transform";import { z } from "zod";import type { MultipartUploadURLs, UploadFile } from "./upload-service";+/**+ * A variant of {@link retryEnsuringHTTPOk} that understands the cancellation+ * mechanism used by the upload subsystem.+ *+ * @param abortIfCancelled A function that aborts the operation by throwing a+ * error with the message set to {@link CustomError.UPLOAD_CANCELLED} if the+ * user has cancelled the upload.+ *+ * @param request A function that returns a new promise for a request that we+ * want to retry.+ *+ * This function will retry requests (obtained afresh each time by calling+ * {@link request}) in the same manner as {@link retryEnsuringHTTPOk}.+ * Additionally, it will call {@link abortIfCancelled} before each attempt, and+ * also bypass the retries when the abort happens on such cancellations.+ */+export const retryEnsuringHTTPOkUnlessCanclelled = (+ abortIfCancelled: () => void,+ request: () => Promise<Response>,+) =>+ retryAsyncOperation(+ async () => {+ const r = await request();+ ensureOk(r);+ return r;+ },+ (e) => {+ if (e instanceof Error && e.message == CustomError.UPLOAD_CANCELLED)+ throw e;+ },+ );+/*** A pre-signed URL alongwith the associated object key that is later used to* refer to file contents (the "object") that were uploaded to this URL.