-
Notifications
You must be signed in to change notification settings - Fork 27.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
With all remotePatterns allowed for images, some image URLs are still rejected #60483
Comments
@WillCalderwood Seems to be a "qwerk" with the micromatch lib which is used to generate a RegEx based on globs. I messed around with this a bit and was able to produce a working pathname glob for this URL. This issue is the dot
|
I tried:
But unfortunately does not work. Do you have any other solutions? EDIT:
|
…60488) ### Fixing a bug ### What? Fix remotePatterns when all paths and/or domains are allowed. ### Why? micromatch creates a very strange regex for all paths - `/^(?:(?!\.)(?:(?:(?!(?:^|[\\/])\.).)*?)[\\/]?)$/`. That is, paths cannot start with a dot or contain a slash followed by a dot. Interestingly, here are some valid paths: - /a/a.a/6a00d8341c4fbe53ef02c8d3a82122200d-600wi - ////a/a.a/6a00d8341c4fbe53ef02c8d3a82122200d-600wi - ///:?%;№%/a/a.a/6a00d8341c4fbe53ef02c8d3a82122200d-600wi.\/ - /:./6a00d8341c4fbe53ef02c8d3a82122200d-600wi.\/ And here are some invalid ones: - /.a/6a00d8341c4fbe53ef02c8d3a82122200d-600wi - /a/.a/6a00d8341c4fbe53ef02c8d3a82122200d-600wi - ./a/6a00d8341c4fbe53ef02c8d3a82122200d-600wi I don't think this check makes any sense. ### How? If the user allows all (`**`) - it means any path or domain will be considered valid. - Fixes #60483 - Fixes #58139 - Fixes #46903 --------- Co-authored-by: Steven <steven@ceriously.com>
This closed issue has been automatically locked because it had no new activity for 2 weeks. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you. |
Link to the code that reproduces this issue
https://github.com/WillCalderwood/next-bug
To Reproduce
Current vs. Expected behavior
The image
https://bioage.typepad.com/.a/6a00d8341c4fbe53ef02c8d3a82122200d-600wi
is not allowed when all image remotes are set as valid with:The image should not be throwing an error.
Note: It works correctly with
unoptimized={true}
specified.Verify canary release
Provide environment information
Which area(s) are affected? (Select all that apply)
Image optimization (next/image, next/legacy/image)
Which stage(s) are affected? (Select all that apply)
Vercel (Deployed)
Additional context
No response
The text was updated successfully, but these errors were encountered: