mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-19 17:38:19 +08:00
core: fix warnings
This commit is contained in:
1 parent
2daa7e2034
commit
a2bbb7a0e3
6 files changed
+10
-8
No files matched your search
@@ -50,13 +50,15 @@ class ProblemImportHydroHandler extends Handler {
|
||||
});
|
||||
});
|
||||
try {
|
||||
const problems = await fs.readdir(tmpdir);
|
||||
for (const i of problems) {
|
||||
const problems = await fs.readdir(tmpdir, { withFileTypes: true });
|
||||
for (const { name: i, isDirectory } of problems) {
|
||||
if (!isDirectory()) continue;
|
||||
const files = await fs.readdir(path.join(tmpdir, i));
|
||||
if (!files.includes('problem.yaml')) continue;
|
||||
const content = fs.readFileSync(path.join(tmpdir, i, 'problem.yaml'), 'utf-8');
|
||||
const pdoc: ProblemDoc = yaml.load(content) as any;
|
||||
let pid = pdoc?.pid;
|
||||
if (!pdoc) continue;
|
||||
let pid = pdoc.pid;
|
||||
if (pid) {
|
||||
const current = await problem.get(domainId, pid);
|
||||
if (current) pid = undefined;
|
||||
|
||||
Reference in new issue
Block a user