fix(utils): exclude invalid URL chars#4262
Merged
lukastaegert merged 5 commits intorollup:masterfrom Nov 12, 2021
Merged
Conversation
* see [URL syntax: RFC 2396](https://datatracker.ietf.org/doc/html/rfc2396) * closes rollup#4222
7 tasks
lukastaegert
approved these changes
Nov 6, 2021
Member
lukastaegert
left a comment
There was a problem hiding this comment.
As we are sanitizing anyway and you can easily opt out by providing your own custom sanitizer, I agree that this is a reasonable default 👍
Codecov Report
@@ Coverage Diff @@
## master nuxt/framework#4262 +/- ##
=======================================
Coverage 98.39% 98.39%
=======================================
Files 204 204
Lines 7288 7289 +1
Branches 2081 2081
=======================================
+ Hits 7171 7172 +1
Misses 58 58
Partials 59 59
Continue to review full report at Codecov.
|
Contributor
Author
|
Would you welcome including these other characters too? If so I can update 👍 |
Member
|
Should probably be fine to include as well |
027862d to
122a30e
Compare
lukastaegert
approved these changes
Nov 9, 2021
10 tasks
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR contains:
Are tests included?
Breaking Changes?
List any relevant issue numbers:
resolves #4222
context: nuxt/nuxt#12606
Description
This PR removes characters that are excluded from valid URLs (see RFC 2396). As rollup-produced files may be consumed by browsers, this is one approach to provide broader ecosystem safety without requiring URL encoding.
The context is this issue. I'm aware we can simply sanitize downstream with output.sanitizeFilename, but felt that RFC2396 might be a reasonable standards-based reasong for excluding these characters.
This PR also serves to solve the issue (solely replicable in ESM context) where
#in filenames breaks imports: #4222.In response to #4222, @lukastaegert observed:
I've marked this as non-breaking as I can't see how a chunk filename could be depended upon, but happily will defer. I'm also happy for this to be closed and to implement this instead with configuration with
output.sanitizeFilename.