fix(next/image): improve svg heuristic for unoptimized (#72970)
The `<Image>` component doesn't optimize SVG images since they are vector images and can already scale up and down to any width. Therefore, the component will try to detect SVG images based on the file name to avoid sending them to the Image Optimization API at all. This is because the default behavior of the Image Optimization API is to error for SVG images due to the security implications of `<svg>` with nested `<script>`, etc (unless `dangerouslyAllowSVG` is enabled. However, we don't want users to reach for `dangerouslyAllowSVG` because it is not usually what they intended. So instead, we can improve the heuristic for detecting SVG in the `<Image>` component by ignoring the query string. Related to https://github.com/nodejs/nodejs.org/pull/7244
Showing
Please
register
or
sign in
to comment