Skip to content

Commit cf1f929

Browse files
authored
fix: Fx svg upload (#5544)
## Description 1. What is this PR about (link the issue and add a short description) ## Steps for reproduction 1. click button 2. expect xyz ## Code Review - [ ] hi @kof, I need you to do - conceptual review (architecture, feature-correctness) - detailed review (read every line) - test it on preview ## Before requesting a review - [ ] made a self-review - [ ] added inline comments where things may be not obvious (the "why", not "what") ## Before merging - [ ] tested locally and on preview environment (preview dev login: 0000) - [ ] updated [test cases](https://github.com/webstudio-is/webstudio/blob/main/apps/builder/docs/test-cases.md) document - [ ] added tests - [ ] if any new env variables are added, added them to `.env` file
1 parent 0289ab6 commit cf1f929

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

packages/asset-uploader/src/utils/get-asset-data.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,13 @@ export const getAssetData = async (
3636
let image: undefined | { format: string; width: number; height: number };
3737
try {
3838
const parsed = imageMeta(Buffer.from(options.data));
39-
if (parsed.type && parsed.width && parsed.height) {
39+
if (parsed.type) {
4040
image = {
4141
format: parsed.type,
42-
width: parsed.width,
43-
height: parsed.height,
42+
// SVG images may not have explicit width/height dimensions
43+
// (they use viewBox instead), so we default to 0 if missing
44+
width: parsed.width ?? 0,
45+
height: parsed.height ?? 0,
4446
};
4547
}
4648
} catch {

0 commit comments

Comments
 (0)