From 84c1e9e0e41dc7f9cd17a4843d133ee678c878cc Mon Sep 17 00:00:00 2001 From: undefined Date: Sat, 31 Oct 2020 22:36:44 +0800 Subject: [PATCH] =?UTF-8?q?core:=20=E4=BF=AE=E6=AD=A3pid=E7=BC=96=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/hydrooj/package.json | 2 +- packages/hydrooj/src/handler/problem.ts | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/packages/hydrooj/package.json b/packages/hydrooj/package.json index b56db0aed..6ad6afbf7 100644 --- a/packages/hydrooj/package.json +++ b/packages/hydrooj/package.json @@ -1,6 +1,6 @@ { "name": "hydrooj", - "version": "2.13.30", + "version": "2.13.31", "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 2d23ca8db..88dc8930a 100644 --- a/packages/hydrooj/src/handler/problem.ts +++ b/packages/hydrooj/src/handler/problem.ts @@ -418,7 +418,10 @@ export class ProblemEditHandler extends ProblemManageHandler { @param('content', Types.String, isContent) async post(domainId: string, title: string, content: string) { const $update: Partial = { title, content }; - if (this.request.body.pid) $update.pid = checkPid(this.request.body.pid); + if (this.request.body.pid) { + if (this.request.body.pid.toString() === this.pdoc.docId.toString()) $update.pid = this.request.body.pid; + else $update.pid = checkPid(this.request.body.pid); + } const pdoc = await problem.get(domainId, this.request.params.pid); await problem.edit(domainId, pdoc.docId, $update); this.response.redirect = this.url('problem_detail', { pid: this.request.params.pid });