fix: escape % if URI malformed#5535
Conversation
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
Thank you for your contribution! ❤️You can try out this pull request locally by installing Rollup via npm install baseballyama/rollup#fix/5441Notice: Ensure you have installed the latest stable Rust toolchain. If you haven't installed it yet, please see https://www.rust-lang.org/tools/install to learn how to download Rustup and install Rust. or load it into the REPL: |
Performance report!Rough benchmark
Internal benchmark
|
|
Not sure I see the value of |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #5535 +/- ##
=======================================
Coverage 99.04% 99.04%
=======================================
Files 238 238
Lines 9248 9248
Branches 2437 2437
=======================================
Hits 9160 9160
Misses 58 58
Partials 30 30 ☔ View full report in Codecov by Sentry. |
I kept Therefore I replace only illegal |
I added tests. |
This will not work if you not also replace the file name on disk. Take the original stackblitz reproduction https://stackblitz.com/edit/rollup-repro-jhg2my?file=dist%2Fmain.js If you instead use %20 in the file name and build it and try to run it via Either you replace it all the time with In any case, I do not think this is a breaking change either way because using |
|
Thank you for checking this PR again!🙏
I think it will be fixed because
This is the reason why I don’t use the return value of decodeURIComponent. I’m using a name even if % is contained as much as possible, but if the name cannot be used, I replace
If the rollup team doesn’t recognize this as a breaking change, I will follow their decision. Obviously, just adding I could be wrong (as this is my first PR in the rollup repo), but I don’t feel that there is a correct common understanding of the changes in this PR. So, for now, I will wait for your response instead of updating the PR. |
This is my point, to my understanding it is impossible to import a file that contains a percent sign EXCEPT if the import is written differently from the file name and URL-escapes the percent sign. E.g. if the file is named
This fixes situations where the file name is not a valid URL-encoded string, but if it is valid, the import fails at runtime. That is my point. Just create an empty file |
|
Finally I got the point! Thank you for your explanation! |
lukastaegert
left a comment
There was a problem hiding this comment.
Sorry for letting this drop for a while, of course this is fine now!
This PR contains:
Are tests included?
Breaking Changes?
List any relevant issue numbers:
%will lead toURI malformederror #5441Description
At first I thought of simply replacing
%with_, but that would intentionally break all URL-encoded filenames. This is not a good idea, so I useddecodeURIComponentto change%to_only if an abnormal%is present.At least one major Node.js / browser has
decodeURIComponent, but whenever it does not,%is replaced with_.