Commit a4a4b13
authored
fix: skip jimp processing for SVGs and prevent image-fill collapse (#298)
* fix: skip jimp processing for SVGs and prevent image-fill collapse
Two fixes:
1. SVGs are vector files that jimp can't parse. Skip dimension detection
and cropping for SVG downloads — just save the file. Previously this
crashed with "Could not find MIME for Buffer".
2. The SVG container collapse logic was swallowing frames that contain
image fills. A carousel with 4 image-filled children would cascade-
collapse into a single IMAGE-SVG node, losing all child structure.
Now checks for image fills in the subtree before collapsing.
* perf: check only direct children for image fills during SVG collapse
afterChildren runs bottom-up, so if a deeper descendant has image fills,
its parent won't collapse and stays FRAME—which isn't SVG-eligible,
naturally breaking the cascade. No need to walk the full subtree.1 parent 0417766 commit a4a4b13
2 files changed
Lines changed: 33 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
239 | 239 | | |
240 | 240 | | |
241 | 241 | | |
242 | | - | |
| 242 | + | |
| 243 | + | |
243 | 244 | | |
244 | 245 | | |
245 | 246 | | |
| |||
249 | 250 | | |
250 | 251 | | |
251 | 252 | | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
105 | 105 | | |
106 | 106 | | |
107 | 107 | | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
108 | 120 | | |
109 | 121 | | |
110 | 122 | | |
| |||
0 commit comments