Skip to content

fix: encode filename only#16412

Closed
Dev-MV6 wants to merge 1 commit intovitejs:mainfrom
Dev-MV6:main
Closed

fix: encode filename only#16412
Dev-MV6 wants to merge 1 commit intovitejs:mainfrom
Dev-MV6:main

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.

@bolt-new-by-stackblitz
Copy link

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.

1 participant