π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
Prevent zero-byte file uploads from web app
Manav Rathi5b630e4946bf
diff --git a/web/apps/photos/src/components/UploadProgress.tsx b/web/apps/photos/src/components/UploadProgress.tsxindex f5366faeeb..6715db87c6 100644--- a/web/apps/photos/src/components/UploadProgress.tsx+++ b/web/apps/photos/src/components/UploadProgress.tsx@@ -278,6 +278,7 @@ const notUploadedFileCount = (c += finishedUploads.get("largerThanAvailableStorage")?.length ?? 0;c += finishedUploads.get("tooLarge")?.length ?? 0;c += finishedUploads.get("unsupported")?.length ?? 0;+ c += finishedUploads.get("zeroSize")?.length ?? 0;return c;};@@ -364,6 +365,11 @@ function UploadProgressDialog() {sectionTitle={t("unsupported_files")}sectionInfo={t("unsupported_files_hint")}/>+ <ResultSection+ resultType="zeroSize"+ sectionTitle={t("zero_size_files")}+ sectionInfo={t("zero_size_files_hint")}+ /><ResultSectionresultType="tooLarge"sectionTitle={t("large_files")}diff --git a/web/packages/base/locales/en-US/translation.json b/web/packages/base/locales/en-US/translation.jsonindex 30d4c5db1a..0bf2fca972 100644--- a/web/packages/base/locales/en-US/translation.json+++ b/web/packages/base/locales/en-US/translation.json@@ -323,6 +323,8 @@"thumbnail_generation_failed_hint": "These files were uploaded, but unfortunately we could not generate the thumbnails for them.","unsupported_files": "Unsupported files","unsupported_files_hint": "Ente does not support these file formats yet",+ "zero_size_files": "Empty files",+ "zero_size_files_hint": "These files were not uploaded as they have zero bytes","blocked_uploads": "Blocked uploads","blocked_uploads_hint": "Your browser or an addon is preventing Ente from using <code>eTags</code> to upload large files.","large_files": "Large files",diff --git a/web/packages/gallery/services/upload/index.ts b/web/packages/gallery/services/upload/index.tsindex da3d7891d2..993d70616f 100644--- a/web/packages/gallery/services/upload/index.ts+++ b/web/packages/gallery/services/upload/index.ts@@ -434,6 +434,7 @@ export type UploadPhase =export type UploadResult =| { type: "unsupported" }+ | { type: "zeroSize" }| { type: "tooLarge" }| { type: "largerThanAvailableStorage" }| { type: "blocked" }diff --git a/web/packages/gallery/services/upload/upload-service.ts b/web/packages/gallery/services/upload/upload-service.tsindex 628fcae463..b1f08347a5 100644--- a/web/packages/gallery/services/upload/upload-service.ts+++ b/web/packages/gallery/services/upload/upload-service.ts@@ -692,6 +692,8 @@ export const upload = async (const { fileTypeInfo, fileSize, lastModifiedMs } = assetDetails;+ if (fileSize === 0) return { type: "zeroSize" };+const maxFileSize = 10 * 1024 * 1024 * 1024; /* 10 GB */if (fileSize >= maxFileSize) return { type: "tooLarge" };