Skip to content
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

fix: handle encoded base paths #17577

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

fix: handle encoded base paths #17577

wants to merge 1 commit into from

Conversation

bluwy
Copy link
Member

@bluwy bluwy commented Jun 27, 2024

Description

Due to the changes from #15311 (and tweaks thereafter) (Vite 5.2), I believe it broke most cases of base that contains encoded base paths, e.g. /foo%20bar/, which Vite encodes internally even if you pass /foo bar/.

I'm somewhat relieved that we didn't get a lot of reports of this, because base paths that look like this are hard 🥲


Because resolvedConfig.base is a URL-encoded string, when we merge it with some un-encoded strings, and encode the merged string, the base portion will get double encoded. The solution in this PR is to decode the base first.

In the future, maybe we can revisit if we want to have resolvedConfig.base be decoded only, or introduce a new resolvedConfig.decodedBase? Or we can say we don't support strange base paths.

NOTE: I also updated the code in plugin-legacy together as I noticed it while searching the codebase.

@bluwy bluwy added p3-minor-bug An edge case that only affects very specific usage (priority) regression The issue only appears after a new release labels Jun 27, 2024
Copy link

stackblitz bot commented Jun 27, 2024

Review PR in StackBlitz Codeflow Run & review this pull request in StackBlitz Codeflow.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file is largely a copy of the other test files.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
p3-minor-bug An edge case that only affects very specific usage (priority) regression The issue only appears after a new release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant