core: fix formidable types

This commit is contained in:
undefined committed 2022-05-12 00:32:35 +08:00
1 parent 67ec4cea0c
commit 1e286b069f
7 files changed
+21 -20

No files matched your search

+3 -3
View File
@@ -104,15 +104,15 @@ class FpsProblemImportHandler extends Handler {
if (!this.request.files.file) throw new ValidationError('file');
const tasks = [];
try {
const file = await fs.stat(this.request.files.file.path);
const file = await fs.stat(this.request.files.file.filepath);
if (file.size > 64 * 1024 * 1024) throw new FileTooLargeError('64m');
const content = fs.readFileSync(this.request.files.file.path, 'utf-8');
const content = fs.readFileSync(this.request.files.file.filepath, 'utf-8');
const result = await xml2js.parseStringPromise(content);
tasks.push(result);
} catch (e) {
if (e instanceof FileTooLargeError) throw e;
console.log(e);
const zip = new AdmZip(this.request.files.file.path);
const zip = new AdmZip(this.request.files.file.filepath);
for (const entry of zip.getEntries()) {
try {
const buf = entry.getData();
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@hydrooj/fps-importer",
"version": "1.3.3",
"version": "1.3.4",
"description": "Import FPS problems",
"main": "package.json",
"repository": "https://github.com/hydro-dev/Hydro.git",