fix: normalizeSVG width and height from viewbox when size includes decimal points (#8939)

Update image.ts
This commit is contained in:
zsviczian 2024-12-22 23:10:11 +01:00 committed by GitHub
parent 1e3399eac8
commit 56fca30bd0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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;
}