fix: Document importer only replaces first base64 encoded image when there are multiple identical images in a document

closes #5653
This commit is contained in:
Tom Moor
2023-08-17 22:46:40 +02:00
parent 41c346d105
commit 13b067fb3f

View File

@@ -1,5 +1,6 @@
import path from "path"; import path from "path";
import emojiRegex from "emoji-regex"; import emojiRegex from "emoji-regex";
import escapeRegExp from "lodash/escapeRegExp";
import truncate from "lodash/truncate"; import truncate from "lodash/truncate";
import mammoth from "mammoth"; import mammoth from "mammoth";
import quotedPrintable from "quoted-printable"; import quotedPrintable from "quoted-printable";
@@ -221,7 +222,10 @@ async function documentImporter({
ip, ip,
transaction, transaction,
}); });
text = text.replace(uri, attachment.redirectUrl); text = text.replace(
new RegExp(escapeRegExp(uri), "g"),
attachment.redirectUrl
);
} }
// It's better to truncate particularly long titles than fail the import // It's better to truncate particularly long titles than fail the import