Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

Raise internal Photos upload limit in clients

Neeraj Gupta9e8578b3e1b4
diff --git a/mobile/apps/photos/lib/module/upload/service/file_uploader.dart b/mobile/apps/photos/lib/module/upload/service/file_uploader.dart
index ae38a86854..ec7b934751 100644
--- a/mobile/apps/photos/lib/module/upload/service/file_uploader.dart
+++ b/mobile/apps/photos/lib/module/upload/service/file_uploader.dart
@@ -51,6 +51,7 @@ class FileUploader {
static const kMaximumConcurrentUploads = 4;
static const kMaximumConcurrentVideoUploads = 2;
static const kMaxFileSize10Gib = 10737418240;
+ static const kMaxFileSize20Gib = 21474836480;
static const kBlockedUploadsPollFrequency = Duration(seconds: 2);
static const _longRunningUploadThreshold = Duration(minutes: 50);
static const k20MBStorageBuffer = 20 * 1024 * 1024;
@@ -904,13 +905,16 @@ class FileUploader {
throw StorageLimitExceededError();
}
final estimatedEncryptedSize = CryptoUtil.estimateEncryptedSize(fileSize);
- if (estimatedEncryptedSize > kMaxFileSize10Gib) {
+ final maxFileSize = flagService.flags.internalUser
+ ? kMaxFileSize20Gib
+ : kMaxFileSize10Gib;
+ if (estimatedEncryptedSize > maxFileSize) {
_logger.warning(
- 'Encrypted file size exceeds 10GiB sourceSize $fileSize '
+ 'Encrypted file size exceeds $maxFileSize sourceSize $fileSize '
'estimatedEncryptedSize $estimatedEncryptedSize',
);
throw InvalidFileError(
- 'encrypted file size above 10GiB',
+ 'encrypted file size above $maxFileSize',
InvalidReason.tooLargeFile,
);
}
diff --git a/web/apps/photos/src/services/upload-manager.ts b/web/apps/photos/src/services/upload-manager.ts
index f5ba41c5dc..8830c2f213 100644
--- a/web/apps/photos/src/services/upload-manager.ts
+++ b/web/apps/photos/src/services/upload-manager.ts
@@ -541,6 +541,7 @@ class UploadManager {
deferMultipartChecksums:
settings.deferredMultipartChecksumsEnabled &&
(settings.isInternalUser || isDevBuild),
+ isInternalUser: settings.isInternalUser,
skipDuplicateAddToUploadCollection:
options?.skipDuplicateAddToUploadCollection,
includePartnerSharedFiles: options?.includePartnerSharedFiles,
diff --git a/web/packages/gallery/services/upload/upload-service.ts b/web/packages/gallery/services/upload/upload-service.ts
index b74218f658..74e6ac077d 100644
--- a/web/packages/gallery/services/upload/upload-service.ts
+++ b/web/packages/gallery/services/upload/upload-service.ts
@@ -473,6 +473,7 @@ const fileTooLargeErrorMessage = "File too large";
interface UploadContext {
isCFUploadProxyDisabled: boolean;
deferMultipartChecksums: boolean;
+ isInternalUser: boolean;
skipDuplicateAddToUploadCollection?: boolean;
includePartnerSharedFiles?: boolean;
publicAlbumsCredentials?: PublicAlbumsCredentials;
@@ -525,7 +526,8 @@ export const upload = async (
if (fileSize === 0) return { type: "zeroSize" };
- const maxFileSize = 10 * 1024 * 1024 * 1024;
+ const maxFileSize =
+ (uploadContext.isInternalUser ? 20 : 10) * 1024 * 1024 * 1024;
if (fileSize >= maxFileSize) return { type: "tooLarge" };
abortIfCancelled();