forked from vercel/next.js
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(next/image): improve svg heuristic for unoptimized (vercel#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 nodejs/nodejs.org#7244
- Loading branch information
Showing
3 changed files
with
78 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters