chore: increase size limits on uploads

This commit is contained in:
cv
2023-09-27 14:31:14 +02:00
parent e09a7d99f0
commit 30905757f3
@@ -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');
}