From 30905757f38d9106afb349d128253cd529877581 Mon Sep 17 00:00:00 2001 From: cv <34649812+cpvalente@users.noreply.github.com> Date: Wed, 27 Sep 2023 14:31:14 +0200 Subject: [PATCH] chore: increase size limits on uploads --- .../src/features/modals/upload-modal/uploadUtils.ts | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/apps/client/src/features/modals/upload-modal/uploadUtils.ts b/apps/client/src/features/modals/upload-modal/uploadUtils.ts index eea99d93c..0798f97fe 100644 --- a/apps/client/src/features/modals/upload-modal/uploadUtils.ts +++ b/apps/client/src/features/modals/upload-modal/uploadUtils.ts @@ -10,12 +10,18 @@ export function validateFile(file: File): ValidationStatus { status.isValid = false; } - // Limit file size to 1MB - if (file.size > 1000000) { + // Limit file size of a project file to around 1MB + if (file.name.endsWith('.json') && file.size > 1_000_000) { status.errors.push('File size limit (1MB) exceeded'); status.isValid = false; } + // Limit file size of an excel file to around 10MB + if (file.name.endsWith('.xlsx') && file.size > 10_000_000) { + status.errors.push('File size limit (10MB) exceeded'); + status.isValid = false; + } + // Check file extension if (!file.name.endsWith('.xlsx') && !file.name.endsWith('.json')) { status.errors.push('Unhandled file type'); @@ -24,8 +30,6 @@ export function validateFile(file: File): ValidationStatus { return status; } -export type MaybeFile = null | 'ontime' | 'excel'; - export function isExcelFile(file: File | null) { return file?.name.endsWith('.xlsx'); }