mirror of
https://github.com/cpvalente/ontime.git
synced 2026-09-10 08:39:34 +00:00
chore: increase size limits on uploads
This commit is contained in:
@@ -10,12 +10,18 @@ export function validateFile(file: File): ValidationStatus {
|
|||||||
status.isValid = false;
|
status.isValid = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Limit file size to 1MB
|
// Limit file size of a project file to around 1MB
|
||||||
if (file.size > 1000000) {
|
if (file.name.endsWith('.json') && file.size > 1_000_000) {
|
||||||
status.errors.push('File size limit (1MB) exceeded');
|
status.errors.push('File size limit (1MB) exceeded');
|
||||||
status.isValid = false;
|
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
|
// Check file extension
|
||||||
if (!file.name.endsWith('.xlsx') && !file.name.endsWith('.json')) {
|
if (!file.name.endsWith('.xlsx') && !file.name.endsWith('.json')) {
|
||||||
status.errors.push('Unhandled file type');
|
status.errors.push('Unhandled file type');
|
||||||
@@ -24,8 +30,6 @@ export function validateFile(file: File): ValidationStatus {
|
|||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
export type MaybeFile = null | 'ontime' | 'excel';
|
|
||||||
|
|
||||||
export function isExcelFile(file: File | null) {
|
export function isExcelFile(file: File | null) {
|
||||||
return file?.name.endsWith('.xlsx');
|
return file?.name.endsWith('.xlsx');
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user