core: 修复从syzoj2导入题目时测试数据配置抓取异常的错误

This commit is contained in:
undefined committed 2021-01-18 12:24:28 +08:00
1 parent 02e6cede3d
commit 93dddbd0d5
2 files changed
+4 -3

No files matched your search

+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "hydrooj",
"version": "2.15.22",
"version": "2.15.23",
"bin": "bin/hydrooj.js",
"main": "dist/loader.js",
"typings": "dist/loader.d.ts",
+3 -2
View File
@@ -18,7 +18,7 @@ import storage from '../service/storage';
import { isPid } from '../lib/validator';
import download from '../lib/download';
const RE_SYZOJ = /(https?):\/\/([a-zA-Z0-9.:]+)\/(problem|p)\/([0-9]+)\/?/i;
const RE_SYZOJ = /(https?):\/\/([^/]+)\/(problem|p)\/([0-9]+)\/?/i;
const logger = new Logger('import.syzoj');
class ProblemImportSYZOJHandler extends Handler {
@@ -112,11 +112,12 @@ class ProblemImportSYZOJHandler extends Handler {
// eslint-disable-next-line no-await-in-loop
await problem.addTestdata(domainId, docId, entry.entryName, entry.getData());
}
const filename = p.file_io_input_name ? p.file_io_input_name?.split('.')[0] : null;
await problem.edit(domainId, docId, {
config: {
time: `${p.time_limit}ms`,
memory: `${p.memory_limit}m`,
filename: p.file_io_input_name.split('.')[0],
filename,
type: p.type === 'traditional' ? 'default' : p.type,
},
});