From 56fca30bd0ab54018e8b848f06ee061658596561 Mon Sep 17 00:00:00 2001 From: zsviczian Date: Sun, 22 Dec 2024 23:10:11 +0100 Subject: [PATCH] fix: normalizeSVG width and height from viewbox when size includes decimal points (#8939) Update image.ts --- packages/excalidraw/element/image.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/excalidraw/element/image.ts b/packages/excalidraw/element/image.ts index 1753c9b4b9..32644b64d1 100644 --- a/packages/excalidraw/element/image.ts +++ b/packages/excalidraw/element/image.ts @@ -124,7 +124,9 @@ export const normalizeSVG = (SVGString: string) => { height = height || "50"; if (viewBox) { - const match = viewBox.match(/\d+ +\d+ +(\d+) +(\d+)/); + const match = viewBox.match( + /\d+ +\d+ +(\d+(?:\.\d+)?) +(\d+(?:\.\d+)?)/, + ); if (match) { [, width, height] = match; }