fix: Correctly escape RegExp in import tasks

closes #3460
This commit is contained in:
Tom Moor
2022-04-27 23:58:01 -07:00
parent 5f6b6e2879
commit c7e4f491eb
3 changed files with 14 additions and 6 deletions

View File

@@ -1,6 +1,6 @@
import path from "path";
import JSZip from "jszip";
import { compact } from "lodash";
import { compact, escapeRegExp } from "lodash";
import mime from "mime-types";
import { v4 as uuidv4 } from "uuid";
import documentImporter from "@server/commands/documentImporter";
@@ -148,7 +148,7 @@ export default class ImportNotionTask extends ImportTask {
);
} else {
text = text.replace(
new RegExp(image.src, "g"),
new RegExp(escapeRegExp(image.src), "g"),
`<<${attachment.id}>>`
);
}