migrate: hustoj: ignore image not exist

pull/651/head
undefined 1 year ago
parent 5403848bc6
commit 7edff0a1ab
No known key found for this signature in database

@ -176,8 +176,12 @@ export async function run({
}, 'html');
const uploadFiles = content.matchAll(/(?:src|href)="\/upload\/([^"]+\/([^"]+))"/g);
for (const file of uploadFiles) {
try {
files[file[2]] = await fs.readFile(path.join(uploadDir, file[1]));
content = content.replace(`/upload/${file[1]}`, `file://${file[2]}`);
} catch (e) {
report({ message: `failed to read file: ${path.join(uploadDir, file[1])}` });
}
}
const pid = await ProblemModel.add(
domainId, `P${pdoc.problem_id}`,

Loading…
Cancel
Save