next.js
e8a82214 - fix:(next/image) handle `remotePatterns` with a dot in the pathname (#60488)

Commit
2 years ago
fix:(next/image) handle `remotePatterns` with a dot in the pathname (#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>
Author
Parents
Loading