diff --git a/src/ipx.ts b/src/ipx.ts index 6d8cc81..1432bc1 100644 --- a/src/ipx.ts +++ b/src/ipx.ts @@ -340,12 +340,22 @@ export function createIPX(userOptions: IPXOptions): IPX { let imageMeta: ImageMeta; try { imageMeta = getImageMeta(sourceData) as ImageMeta; - } catch { - throw new HTTPError({ - statusCode: 400, - statusText: `IPX_INVALID_IMAGE`, - message: `Cannot parse image metadata: ${id}`, - }); + } catch (error) { + const textSample = sourceData.subarray(0, 1024).toString("utf8"); + if (textSample.includes(" { statusText: "IPX_INVALID_SVG", }); }); + + it("processes svg with symbol and use tags without dimensions on root", async () => { + const svgWithSymbol = ``; + const output = await processSVG(svgWithSymbol); + expect(output).toContain(" {