fix: SVG metadata extraction regex on multiline elements (#5074)

* Fix SVG metadata extraction regex on multiline elements

* remove multiline flag
This commit is contained in:
Achille Lacoin 2022-04-20 17:07:58 +02:00 committed by GitHub
parent cd942c3e3b
commit b5a46dd671
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -105,7 +105,9 @@ export const encodeSvgMetadata = async ({ text }: { text: string }) => {
export const decodeSvgMetadata = async ({ svg }: { svg: string }) => {
if (svg.includes(`payload-type:${MIME_TYPES.excalidraw}`)) {
const match = svg.match(/<!-- payload-start -->(.+?)<!-- payload-end -->/);
const match = svg.match(
/<!-- payload-start -->\s*(.+?)\s*<!-- payload-end -->/,
);
if (!match) {
throw new Error("INVALID");
}