mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-21 01:46:28 +08:00
core: import: check pid validity
This commit is contained in:
1 file changed
+2
-2
@@ -442,8 +442,8 @@ export class ProblemModel {
|
|||||||
if (!pdoc) continue;
|
if (!pdoc) continue;
|
||||||
let pid = pdoc.pid;
|
let pid = pdoc.pid;
|
||||||
if (pid) {
|
if (pid) {
|
||||||
const current = await ProblemModel.get(domainId, pid);
|
if (!(/^[A-Za-z]+[0-9]*$/.test(pid))) pid = undefined;
|
||||||
if (current) pid = undefined;
|
else if (await ProblemModel.get(domainId, pid)) pid = undefined;
|
||||||
}
|
}
|
||||||
const overrideContent = findOverrideContent(path.join(tmpdir, i));
|
const overrideContent = findOverrideContent(path.join(tmpdir, i));
|
||||||
const docId = await ProblemModel.add(
|
const docId = await ProblemModel.add(
|
||||||
|
|||||||
Reference in new issue
Block a user