mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-19 01:38:19 +08:00
ui: file upload support
This commit is contained in:
1 parent
2539dfa412
commit
595f28b1df
5 files changed
+64
-22
No files matched your search
@@ -389,10 +389,11 @@ export class ProblemFilesHandler extends ProblemDetailHandler {
|
||||
this.response.body.links = links;
|
||||
}
|
||||
|
||||
@post('filename', Types.Name)
|
||||
@post('type', Types.Content, true)
|
||||
@post('filename', Types.Name, true)
|
||||
@post('type', Types.Range(['testdata', 'additional_file']), true)
|
||||
async postUploadFile(domainId: string, filename: string, type = 'testdata') {
|
||||
if (!this.request.files.file) throw new ValidationError('file');
|
||||
if (!filename) filename = this.request.files.file.name || String.random(16);
|
||||
if (this.pdoc.owner !== this.user._id) this.checkPerm(PERM.PERM_EDIT_PROBLEM);
|
||||
if (filename.endsWith('.zip')) {
|
||||
const zip = new AdmZip(this.request.files.file.path);
|
||||
|
||||
Reference in new issue
Block a user