diff --git a/packages/hydrooj/package.json b/packages/hydrooj/package.json index 6de59e9e1..2d1b59ec9 100644 --- a/packages/hydrooj/package.json +++ b/packages/hydrooj/package.json @@ -1,6 +1,6 @@ { "name": "hydrooj", - "version": "2.20.5", + "version": "2.20.6", "bin": "bin/hydrooj.js", "main": "dist/loader.js", "typings": "dist/loader.d.ts", diff --git a/packages/hydrooj/src/handler/problem.ts b/packages/hydrooj/src/handler/problem.ts index fa75169cd..0798af2f3 100644 --- a/packages/hydrooj/src/handler/problem.ts +++ b/packages/hydrooj/src/handler/problem.ts @@ -328,7 +328,7 @@ export class ProblemEditHandler extends ProblemManageHandler { try { content = JSON.parse(content); } catch { /* Ignore */ } - if (await problem.get(domainId, newPid)) throw new BadRequestError('new pid exists'); + if (newPid !== this.pdoc.pid && await problem.get(domainId, newPid)) throw new BadRequestError('new pid exists'); const $update: Partial = { title, content, pid: newPid, hidden, tag, };