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: encode filename only #16412

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

fix: encode filename only #16412

wants to merge 1 commit into from

Conversation

Dev-MV6
Copy link

@Dev-MV6 Dev-MV6 commented Apr 12, 2024

Description

A filename /favicon-32x32.png with the base /foo bar/ returns /foo%20bar/favicon-32x32.png as the URL, Vite should only encode the filename part (favicon-32x32.png). This to avoid re-encoding the base, which has already been encoded once it's parsed in the configuration validation step.

Before fix

An HTML code like:

<link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png" />

Along with a base like /Password generator app/ builds:

<link rel="icon" type="image/png" sizes="32x32" href="/Password%2520generator%2520app/favicon-32x32.png" />

After fix

The same HTML code now builds:

<link rel="icon" type="image/png" sizes="32x32" href="/Password%20generator%20app/favicon-32x32.png" />

Additional context

Same fix has also been applied for assets URLs inside CSS and JS bundles after building.

Copy link

stackblitz bot commented Apr 12, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant