From b5a46dd67119fe86f467bdfae878b8d2a596fd77 Mon Sep 17 00:00:00 2001 From: Achille Lacoin Date: Wed, 20 Apr 2022 17:07:58 +0200 Subject: [PATCH] fix: SVG metadata extraction regex on multiline elements (#5074) * Fix SVG metadata extraction regex on multiline elements * remove multiline flag --- src/data/image.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/data/image.ts b/src/data/image.ts index 912a7084..1c1a0a92 100644 --- a/src/data/image.ts +++ b/src/data/image.ts @@ -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(/(.+?)/); + const match = svg.match( + /\s*(.+?)\s*/, + ); if (!match) { throw new Error("INVALID"); }