mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
core: add sanitize-filename
This commit is contained in:
5 files changed
+6
-5
No files matched your search
@@ -641,7 +641,6 @@ export class ContestManagementHandler extends ContestManagementBaseHandler {
|
||||
throw new FileLimitExceededError('size');
|
||||
}
|
||||
filename ||= file.originalFilename || String.random(16);
|
||||
if (filename.includes('/') || filename.includes('..')) throw new ValidationError('filename', null, 'Bad filename');
|
||||
await storage.put(`contest/${domainId}/${tid}/${filename}`, file.filepath, this.user._id);
|
||||
const meta = await storage.getMeta(`contest/${domainId}/${tid}/${filename}`);
|
||||
const payload = { _id: filename, name: filename, ...pick(meta, ['size', 'lastModified', 'etag']) };
|
||||
|
||||
Reference in new issue
Block a user