core: api: problem.manage.edit & problem.manage.delete

This commit is contained in:
undefined committed 2021-10-27 22:42:40 +08:00
1 parent a75804362d
commit 5d9310fb78
7 files changed
+62 -15

No files matched your search

+3 -1
View File
@@ -1,4 +1,5 @@
/* eslint-disable camelcase */
import { statSync } from 'fs';
import { pick } from 'lodash';
import { lookup } from 'mime-types';
import {
@@ -47,7 +48,8 @@ export class FilesHandler extends Handler {
throw new ForbiddenError('File limit exceeded.');
}
if (!this.request.files.file) throw new ValidationError('file');
const size = Math.sum((this.user._files || []).map((i) => i.size));
const f = statSync(this.request.files.file.path);
const size = Math.sum((this.user._files || []).map((i) => i.size)) + f.size;
if (size >= system.get('limit.user_files_size')) {
throw new ForbiddenError('File size limit exceeded.');
}