-
Notifications
You must be signed in to change notification settings - Fork 27.5k
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
Sanitize the path to the user config before importing #30003
Merged
Merged
Conversation
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
ionut-botizan
requested review from
huozhi,
ijjk,
padmaia,
shuding,
styfle and
timneutkens
as code owners
October 17, 2021 21:27
Stats from current PRDefault Build (Decrease detected ✓)General Overall increase
|
vercel/next.js canary | ionut-botizan/next.js bugfix/user-config-import | Change | |
---|---|---|---|
buildDuration | 15.6s | 15.5s | -48ms |
buildDurationCached | 3.6s | 3.5s | -44ms |
nodeModulesSize | 195 MB | 195 MB |
Page Load Tests Overall decrease ⚠️
vercel/next.js canary | ionut-botizan/next.js bugfix/user-config-import | Change | |
---|---|---|---|
/ failed reqs | 0 | 0 | ✓ |
/ total time (seconds) | 3.633 | 3.787 | |
/ avg req/sec | 688.15 | 660.16 | |
/error-in-render failed reqs | 0 | 0 | ✓ |
/error-in-render total time (seconds) | 1.909 | 1.899 | -0.01 |
/error-in-render avg req/sec | 1309.49 | 1316.65 | +7.16 |
Client Bundles (main, webpack, commons)
vercel/next.js canary | ionut-botizan/next.js bugfix/user-config-import | Change | |
---|---|---|---|
558.HASH.js gzip | 3.02 kB | 3.02 kB | ✓ |
779.HASH.js gzip | 179 B | 179 B | ✓ |
framework-HASH.js gzip | 42.2 kB | 42.2 kB | ✓ |
main-HASH.js gzip | 25 kB | 25 kB | ✓ |
webpack-HASH.js gzip | 1.49 kB | 1.49 kB | ✓ |
Overall change | 71.9 kB | 71.9 kB | ✓ |
Legacy Client Bundles (polyfills)
vercel/next.js canary | ionut-botizan/next.js bugfix/user-config-import | Change | |
---|---|---|---|
polyfills-a4..dd70.js gzip | 31 kB | 31 kB | ✓ |
Overall change | 31 kB | 31 kB | ✓ |
Client Pages
vercel/next.js canary | ionut-botizan/next.js bugfix/user-config-import | Change | |
---|---|---|---|
_app-HASH.js gzip | 977 B | 977 B | ✓ |
_error-HASH.js gzip | 3.11 kB | 3.11 kB | ✓ |
amp-HASH.js gzip | 553 B | 553 B | ✓ |
css-HASH.js gzip | 328 B | 328 B | ✓ |
dynamic-HASH.js gzip | 2.73 kB | 2.73 kB | ✓ |
head-HASH.js gzip | 2.37 kB | 2.37 kB | ✓ |
hooks-HASH.js gzip | 918 B | 918 B | ✓ |
image-HASH.js gzip | 5.85 kB | 5.85 kB | ✓ |
index-HASH.js gzip | 260 B | 260 B | ✓ |
link-HASH.js gzip | 1.66 kB | 1.66 kB | ✓ |
routerDirect..HASH.js gzip | 320 B | 320 B | ✓ |
script-HASH.js gzip | 386 B | 386 B | ✓ |
withRouter-HASH.js gzip | 319 B | 319 B | ✓ |
bb14e60e810b..30f.css gzip | 125 B | 125 B | ✓ |
Overall change | 19.9 kB | 19.9 kB | ✓ |
Client Build Manifests
vercel/next.js canary | ionut-botizan/next.js bugfix/user-config-import | Change | |
---|---|---|---|
_buildManifest.js gzip | 493 B | 493 B | ✓ |
Overall change | 493 B | 493 B | ✓ |
Rendered Page Sizes
vercel/next.js canary | ionut-botizan/next.js bugfix/user-config-import | Change | |
---|---|---|---|
index.html gzip | 539 B | 539 B | ✓ |
link.html gzip | 550 B | 550 B | ✓ |
withRouter.html gzip | 532 B | 532 B | ✓ |
Overall change | 1.62 kB | 1.62 kB | ✓ |
Default Build with SWC (Decrease detected ✓)
General Overall increase ⚠️
vercel/next.js canary | ionut-botizan/next.js bugfix/user-config-import | Change | |
---|---|---|---|
buildDuration | 7.7s | 7.6s | -32ms |
buildDurationCached | 3.9s | 3.7s | -208ms |
nodeModulesSize | 195 MB | 195 MB |
Page Load Tests Overall decrease ⚠️
vercel/next.js canary | ionut-botizan/next.js bugfix/user-config-import | Change | |
---|---|---|---|
/ failed reqs | 0 | 0 | ✓ |
/ total time (seconds) | 3.659 | 3.712 | |
/ avg req/sec | 683.18 | 673.46 | |
/error-in-render failed reqs | 0 | 0 | ✓ |
/error-in-render total time (seconds) | 1.842 | 1.895 | |
/error-in-render avg req/sec | 1357.05 | 1319.39 |
Client Bundles (main, webpack, commons)
vercel/next.js canary | ionut-botizan/next.js bugfix/user-config-import | Change | |
---|---|---|---|
675-HASH.js gzip | 13.8 kB | 13.8 kB | ✓ |
770.HASH.js gzip | 178 B | 178 B | ✓ |
framework-HASH.js gzip | 50.8 kB | 50.8 kB | ✓ |
main-HASH.js gzip | 35.2 kB | 35.2 kB | ✓ |
webpack-HASH.js gzip | 1.64 kB | 1.64 kB | ✓ |
Overall change | 102 kB | 102 kB | ✓ |
Legacy Client Bundles (polyfills)
vercel/next.js canary | ionut-botizan/next.js bugfix/user-config-import | Change | |
---|---|---|---|
polyfills-a4..dd70.js gzip | 31 kB | 31 kB | ✓ |
Overall change | 31 kB | 31 kB | ✓ |
Client Pages
vercel/next.js canary | ionut-botizan/next.js bugfix/user-config-import | Change | |
---|---|---|---|
_app-HASH.js gzip | 1.33 kB | 1.33 kB | ✓ |
_error-HASH.js gzip | 180 B | 180 B | ✓ |
amp-HASH.js gzip | 315 B | 315 B | ✓ |
css-HASH.js gzip | 331 B | 331 B | ✓ |
dynamic-HASH.js gzip | 2.79 kB | 2.79 kB | ✓ |
head-HASH.js gzip | 355 B | 355 B | ✓ |
hooks-HASH.js gzip | 637 B | 637 B | ✓ |
image-HASH.js gzip | 555 B | 555 B | ✓ |
index-HASH.js gzip | 261 B | 261 B | ✓ |
link-HASH.js gzip | 2.22 kB | 2.22 kB | ✓ |
routerDirect..HASH.js gzip | 326 B | 326 B | ✓ |
script-HASH.js gzip | 393 B | 393 B | ✓ |
withRouter-HASH.js gzip | 322 B | 322 B | ✓ |
bb14e60e810b..30f.css gzip | 125 B | 125 B | ✓ |
Overall change | 10.1 kB | 10.1 kB | ✓ |
Client Build Manifests
vercel/next.js canary | ionut-botizan/next.js bugfix/user-config-import | Change | |
---|---|---|---|
_buildManifest.js gzip | 511 B | 511 B | ✓ |
Overall change | 511 B | 511 B | ✓ |
Rendered Page Sizes
vercel/next.js canary | ionut-botizan/next.js bugfix/user-config-import | Change | |
---|---|---|---|
index.html gzip | 539 B | 539 B | ✓ |
link.html gzip | 552 B | 552 B | ✓ |
withRouter.html gzip | 533 B | 533 B | ✓ |
Overall change | 1.62 kB | 1.62 kB | ✓ |
ijjk
approved these changes
Oct 19, 2021
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR!
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Related to #29971
The issue with the dynamic
import()
is not Windows specific and the current fix is not (entirely) correct, as theimport()
will still fail in some cases.The real issue is that
import()
expects a url-encoded string as parameter and, on Windows, the colon (:
) makes it think that it's a fully qualified URL using a protocol that it doesn't recognize. But that's just part of the story...The other part, which is true for all the POSIX compliant operating systems, is that it will try to decode any url-encoded entities, so, basically, when it encounters a
%
it will try to interpret the following characters as a hex code. So, for example, if it encounters a file path like/foo%20bar/baz.js
, it will interpret it as/foo bar/baz.js
, because%20
is the url-encoded<space>
character.The solution for this is to use the
url.pathToFileURL()
method to properly handle the path, like so:This will properly encode the
%
sign and add the necessary prefix and, given the above example, will generate a url likefile:///foo%2520bar/baz.js
(where%25
is the url-encoded representation of the%
character).To test this behavior yourself, create the following 2 files:
...and run
node main.js
.The output should be something like
Bug
fixes #number
contributing.md
Feature
fixes #number
contributing.md
Documentation / Examples