diff --git a/src/constants/upload/index.ts b/src/constants/upload/index.ts index 27ac07eb7..a34dbf6b3 100644 --- a/src/constants/upload/index.ts +++ b/src/constants/upload/index.ts @@ -39,4 +39,4 @@ export enum FileUploadResults { UPLOADED, } -export const FIVE_GB_IN_BYTES = 5 * 1024 * 1024 * 1024; +export const MAX_FILE_SIZE_SUPPORTED = 5 * 1024 * 1024 * 1024; // 5 GB diff --git a/src/services/upload/uploadManager.ts b/src/services/upload/uploadManager.ts index e3b9bd5e2..1ec3dc07d 100644 --- a/src/services/upload/uploadManager.ts +++ b/src/services/upload/uploadManager.ts @@ -27,7 +27,7 @@ import { import { UPLOAD_STAGES, FileUploadResults, - FIVE_GB_IN_BYTES, + MAX_FILE_SIZE_SUPPORTED, } from 'constants/upload'; import { ComlinkWorker } from 'utils/comlink'; import { getFileType } from './readFileService'; @@ -142,7 +142,7 @@ class UploadManager { const reader = new FileReader(); for (const { file, collectionID } of mediaFiles) { const { fileTypeInfo, metadata } = await (async () => { - if (file.size >= FIVE_GB_IN_BYTES) { + if (file.size >= MAX_FILE_SIZE_SUPPORTED) { return { fileTypeInfo: null, metadata: null }; } const fileTypeInfo = await getFileType(reader, file); diff --git a/src/services/upload/uploader.ts b/src/services/upload/uploader.ts index b26ab3239..a706ddba0 100644 --- a/src/services/upload/uploader.ts +++ b/src/services/upload/uploader.ts @@ -9,7 +9,7 @@ import UploadService from './uploadService'; import uploadService from './uploadService'; import { BackupedFile, FileWithCollection, UploadFile } from 'types/upload'; import { FILE_TYPE } from 'constants/file'; -import { FileUploadResults, FIVE_GB_IN_BYTES } from 'constants/upload'; +import { FileUploadResults, MAX_FILE_SIZE_SUPPORTED } from 'constants/upload'; import { getMetadataMapKey } from './metadataService'; interface UploadResponse { @@ -30,7 +30,7 @@ export default async function uploader( getMetadataMapKey(collection.id, rawFile.name) ); try { - if (rawFile.size >= FIVE_GB_IN_BYTES) { + if (rawFile.size >= MAX_FILE_SIZE_SUPPORTED) { return { fileUploadResult: FileUploadResults.TOO_LARGE }; } if (fileTypeInfo.fileType === FILE_TYPE.OTHERS) {