[fix] handle paths consistently between dev and various production adapters #2171
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.
fixes #2166
dev and
adapter-node
were passing decoded paths while the other adapters were passing the encoded path sent by the browserThe way to handle the path is to split it on forward slashes and then call
decodeURIComponent
on each path component. That allows you to handle edge cases like%2f
. Luckily, that's whatbuild
is currently doing:kit/packages/kit/src/core/build/index.js
Line 614 in c3ca3fb
Otherwise, we shouldn't touch the path. We should just leave it alone and pass along exactly what we received, which is exactly how Express behaves
Previously there was another bug because we were doing
decodeURI
followed bydecodeURIComponent
which would cause each component to be double-decoded. By leaving the path alone we don't run into this issue