From 99f73b492b30d8332cc6a935a465641323d58aa1 Mon Sep 17 00:00:00 2001 From: undefined Date: Fri, 12 Sep 2025 05:08:48 +0800 Subject: [PATCH] fix build --- framework/eslint-config/package.json | 2 +- framework/utils/lib/utils.ts | 2 +- package.json | 2 +- packages/fps-importer/index.ts | 1 + packages/hydrooj/src/handler/problem.ts | 2 +- packages/migrate/scripts/universaloj.ts | 3 ++- packages/ui-default/package.json | 2 +- 7 files changed, 8 insertions(+), 6 deletions(-) diff --git a/framework/eslint-config/package.json b/framework/eslint-config/package.json index bf43745b2..932b0b1ba 100644 --- a/framework/eslint-config/package.json +++ b/framework/eslint-config/package.json @@ -6,7 +6,7 @@ "repository": "https://github.com/hydro-dev/Hydro", "dependencies": { "@antfu/eslint-config": "^5.3.0", - "@eslint-react/eslint-plugin": "^1.53.0", + "@eslint-react/eslint-plugin": "^1.53.1", "@typescript-eslint/eslint-plugin": "^8.43.0", "@typescript-eslint/parser": "^8.43.0", "eslint-plugin-de-morgan": "^1.3.1", diff --git a/framework/utils/lib/utils.ts b/framework/utils/lib/utils.ts index c0bc6408a..e8f338fce 100644 --- a/framework/utils/lib/utils.ts +++ b/framework/utils/lib/utils.ts @@ -354,7 +354,7 @@ export async function extractZip(zipOrEntries: ZipReader | Entry[], dest: for (const entry of entries) { const name = shouldStrip ? entry.filename.substring(entries[0].filename.length) : entry.filename; const d = sanitize(dest, canonical(name)); - if (entry.directory) { + if (entry.directory === true) { await fs.mkdir(d, { recursive: true }); continue; } diff --git a/package.json b/package.json index 3190f2c56..7f172705f 100644 --- a/package.json +++ b/package.json @@ -53,7 +53,7 @@ "mongodb-memory-server": "10.2.0", "nyc": "^17.1.0", "ora": "^8.2.0", - "oxlint": "^1.14.0", + "oxlint": "^1.15.0", "package-json": "^10.0.1", "semver": "^7.7.2", "simple-git": "^3.28.0", diff --git a/packages/fps-importer/index.ts b/packages/fps-importer/index.ts index 49a84fda9..9a682874f 100644 --- a/packages/fps-importer/index.ts +++ b/packages/fps-importer/index.ts @@ -103,6 +103,7 @@ class FpsProblemImportHandler extends Handler { } for (const entry of entries) { try { + if (entry.directory === true) continue; if (entry.uncompressedSize > SystemModel.get('import-fps.limit')) throw new FileTooLargeError(); const content = entry.getData(new Zip.TextWriter()); const result = await xml2js.parseStringPromise(content); diff --git a/packages/hydrooj/src/handler/problem.ts b/packages/hydrooj/src/handler/problem.ts index e2c105046..13455e0f8 100644 --- a/packages/hydrooj/src/handler/problem.ts +++ b/packages/hydrooj/src/handler/problem.ts @@ -721,7 +721,7 @@ export class ProblemFilesHandler extends ProblemDetailHandler { throw new ValidationError('zip', null, e.message); } for (const entry of entries) { - if (!entry.filename || entry.directory) continue; + if (!entry.filename || entry.directory === true) continue; files.push({ type, name: sanitize(entry.filename), diff --git a/packages/migrate/scripts/universaloj.ts b/packages/migrate/scripts/universaloj.ts index ea33a7971..a7411b9e7 100644 --- a/packages/migrate/scripts/universaloj.ts +++ b/packages/migrate/scripts/universaloj.ts @@ -385,7 +385,8 @@ export async function run({ } catch (e) { throw new ValidationError('zip', null, e.message); } - data.code = await entries.find((i) => i.filename.endsWith('answer.code'))?.getData(new Zip.TextWriter()) || ''; + const codeEntry = entries.find((i) => i.filename.endsWith('answer.code') && i.directory === false); + data.code = await (codeEntry as any)?.getData(new Zip.TextWriter()) || ''; } catch { /* ignore no code */ } const result = JSON.parse(Buffer.from(rdoc.result, 'base64').toString('utf8')); if (result.error) { diff --git a/packages/ui-default/package.json b/packages/ui-default/package.json index 61156702d..961ccd9f4 100644 --- a/packages/ui-default/package.json +++ b/packages/ui-default/package.json @@ -107,7 +107,7 @@ "style-loader": "^4.0.0", "stylus": "^0.64.0", "stylus-loader": "7.1.2", - "svgtofont": "^6.4.0", + "svgtofont": "^6.4.1", "tether": "1.4.7", "tether-drop": "^1.4.2", "timeago-react": "^3.0.7",