feat: support WPS report material workbooks
This commit is contained in:
@@ -7,7 +7,14 @@ export function isImageUpload(file: Pick<File, 'name' | 'type'>) {
|
||||
return file.type.toLowerCase().startsWith('image/') || IMAGE_FILE_EXTENSION.test(file.name);
|
||||
}
|
||||
|
||||
export function assertUploadFileSize(file: Pick<File, 'name' | 'size' | 'type'>) {
|
||||
export function assertUploadFileSize(
|
||||
file: Pick<File, 'name' | 'size' | 'type'>,
|
||||
customLimit?: { bytes: number; message: string },
|
||||
) {
|
||||
if (customLimit) {
|
||||
if (file.size > customLimit.bytes) throw new Error(customLimit.message);
|
||||
return;
|
||||
}
|
||||
const image = isImageUpload(file);
|
||||
const limit = image ? IMAGE_UPLOAD_MAX_BYTES : FILE_UPLOAD_MAX_BYTES;
|
||||
if (file.size > limit) {
|
||||
|
||||
Reference in New Issue
Block a user