diff --git a/packages/hydrooj/package.json b/packages/hydrooj/package.json index 302a1909..b4358036 100644 --- a/packages/hydrooj/package.json +++ b/packages/hydrooj/package.json @@ -1,6 +1,6 @@ { "name": "hydrooj", - "version": "2.21.16", + "version": "2.21.17", "bin": "bin/hydrooj.js", "main": "dist/loader.js", "typings": "dist/loader.d.ts", diff --git a/packages/hydrooj/src/handler/contest.ts b/packages/hydrooj/src/handler/contest.ts index 3e39ce66..b076955d 100644 --- a/packages/hydrooj/src/handler/contest.ts +++ b/packages/hydrooj/src/handler/contest.ts @@ -266,10 +266,6 @@ class ContestProblemHandler extends ContestHandler { [this.tdoc.title, 'contest_detail', { tid: this.tdoc.docId }, true], [this.pdoc.title, null, null, true], ]; - // Navigate to current additional file download - // e.g. ![img](a.jpg) will navigate to ![img](./pid/file/a.jpg) - this.response.body.pdoc.content = this.response.body.pdoc.content - .replace(/\(file:\/\//g, `(./${this.pdoc.docId}/file/`); this.response.body = { tdoc: this.tdoc, pdoc: this.pdoc, @@ -279,6 +275,10 @@ class ContestProblemHandler extends ContestHandler { path, page_name: 'contest_detail_problem', }; + // Navigate to current additional file download + // e.g. ![img](a.jpg) will navigate to ![img](./pid/file/a.jpg) + this.response.body.pdoc.content = this.response.body.pdoc.content + .replace(/\(file:\/\//g, `(./${this.pdoc.docId}/file/`); } } diff --git a/packages/utils/lib/utils.ts b/packages/utils/lib/utils.ts index 76d5317a..c128cdd8 100644 --- a/packages/utils/lib/utils.ts +++ b/packages/utils/lib/utils.ts @@ -266,7 +266,7 @@ export function errorMessage(err: Error | string) { for (let i = 0; i < q.length; i++) { if (!q[i].startsWith(' at')) continue; if (q[i].includes(`${sep}@hydrooj${sep}`)) q[i] = q[i].split(`@hydrooj${sep}`)[1]; - else if (q[i].includes(`${sep}hydrooj${sep}`)) q[i] = `hydrooj${sep}${q[i].split(`hydrooj/${sep}`)[1]}`; + else if (q[i].includes(`${sep}hydrooj${sep}`)) q[i] = ` at hydrooj${sep}${q[i].split(`hydrooj${sep}`)[1]}`; } if (typeof err === 'string') return q.join('\n'); err.stack = q.join('\n'); diff --git a/packages/utils/package.json b/packages/utils/package.json index 1e06c4b6..a2f94edd 100644 --- a/packages/utils/package.json +++ b/packages/utils/package.json @@ -1,6 +1,6 @@ { "name": "@hydrooj/utils", - "version": "1.0.0", + "version": "1.0.1", "description": "hydrooj utils", "main": "package.json", "repository": "https://github.com/hydro-dev/Hydro.git", @@ -14,4 +14,4 @@ "devDependencies": { "moment-timezone": "^0.5.33" } -} \ No newline at end of file +}