@@ -1,4 +1,5 @@
|
||||
import JSZip from "jszip";
|
||||
import { escapeRegExp } from "lodash";
|
||||
import mime from "mime-types";
|
||||
import { v4 as uuidv4 } from "uuid";
|
||||
import documentImporter from "@server/commands/documentImporter";
|
||||
@@ -160,9 +161,15 @@ export default class ImportMarkdownZipTask extends ImportTask {
|
||||
|
||||
const reference = `<<${attachment.id}>>`;
|
||||
document.text = document.text
|
||||
.replace(new RegExp(attachment.path, "g"), reference)
|
||||
.replace(new RegExp(normalizedAttachmentPath, "g"), reference)
|
||||
.replace(new RegExp(`/${normalizedAttachmentPath}`, "g"), reference);
|
||||
.replace(new RegExp(escapeRegExp(attachment.path), "g"), reference)
|
||||
.replace(
|
||||
new RegExp(escapeRegExp(normalizedAttachmentPath), "g"),
|
||||
reference
|
||||
)
|
||||
.replace(
|
||||
new RegExp(escapeRegExp(`/${normalizedAttachmentPath}`), "g"),
|
||||
reference
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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}>>`
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user