framework: auto cleanup uploaded files (#818)

This commit is contained in:
undefined committed 2025-01-03 01:01:37 +08:00
1 parent 8eed68e78f
commit 566ebd9bb2
10 files changed
+40 -24

No files matched your search

+4 -4
View File
@@ -129,10 +129,10 @@ class ImportQduojHandler extends Handler {
}
async post({ domainId }) {
if (!this.request.files.file) throw new ValidationError('file');
const stat = await fs.stat(this.request.files.file.filepath);
if (stat.size > 256 * 1024 * 1024) throw new FileTooLargeError('256m');
await this.fromFile(domainId, this.request.files.file.filepath);
const file = this.request.files.file;
if (!file) throw new ValidationError('file');
if (file.size > 256 * 1024 * 1024) throw new FileTooLargeError('256m');
await this.fromFile(domainId, file.filepath);
this.response.redirect = this.url('problem_main');
}
}