mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
core: fix formidable types
This commit is contained in:
1 parent
67ec4cea0c
commit
1e286b069f
7 files changed
+21
-20
No files matched your search
@@ -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,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",
|
||||
|
||||
Reference in new issue
Block a user