core: fix: ProblemAlreadyExistError should be thrown with the new PID, not the old one (#1052)

This commit is contained in:
035966-L3 authored and GitHub committed 2025-10-01 08:49:22 +01:00
1 parent dfc94fdfb4
commit 99e05f878f
1 file changed
+1 -1
+1 -1
View File
@@ -616,7 +616,7 @@ export class ProblemEditHandler extends ProblemManageHandler {
newPid: string | number = '', hidden = false, tag: string[] = [], difficulty = 0,
) {
if (typeof newPid !== 'string') newPid = `P${newPid}`;
if (newPid !== this.pdoc.pid && await problem.get(domainId, newPid)) throw new ProblemAlreadyExistError(pid);
if (newPid !== this.pdoc.pid && await problem.get(domainId, newPid)) throw new ProblemAlreadyExistError(newPid);
const $update: Partial<ProblemDoc> = {
title, content, pid: newPid, hidden, tag: tag ?? [], difficulty, html: false,
};