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

Relative paths in css url() references get double encoded #10868

Closed
1 task done
SibiAkkash opened this issue Apr 24, 2024 · 4 comments
Closed
1 task done

Relative paths in css url() references get double encoded #10868

SibiAkkash opened this issue Apr 24, 2024 · 4 comments
Labels
needs triage Issue needs to be triaged

Comments

@SibiAkkash
Copy link

Astro Info

Astro                    v4.6.4
Node                     v20.10.0
System                   Linux (x64)
Package Manager          npm
Output                   static
Adapter                  none
Integrations             none

If this issue only occurs in one browser, which browser is a problem?

No response

Describe the Bug

I've set base = /blog/John%20Doe in the astro config.

When building and deploying the site, the final path to the assets in css url() references are double encoded.

The output paths in css url() becomes /blog/John%2520Doe/..., when they should stay /blog/John%20Doe/...

The background image url becomes - /blog/John%2520Doe/_astro/[name].[hash].svg

The font url becomes - /blog/John%2520Doe/_astro/[name].[hash].ttf

What's the expected result?

The url() references shouldn't get double encoded. The % character in config.base is getting encoded to %25

Expected asset path in css url() : /blog/John%20Doe/[name].[hash].[ext]
Actual asset path in css url(): /blog/John%2520Doe/[name].[hash].[ext]

Link to Minimal Reproducible Example

https://github.com/SibiAkkash/astro-double-encoding-example

Participation

  • I am willing to submit a pull request for this issue.
@github-actions github-actions bot added the needs triage Issue needs to be triaged label Apr 24, 2024
@matthewp
Copy link
Contributor

Why don't you set base to /blog/John Doe in that case?

@SibiAkkash
Copy link
Author

Why don't you set base to /blog/John Doe in that case?

I had tried that too, the same issue occurs.

@matthewp
Copy link
Contributor

Ok, this is an upstream bug that is being fixed here: vitejs/vite#16412 @bluwy is going to work on getting that finalized which should then fix in Astro as well.

@SibiAkkash
Copy link
Author

Thanks @matthewp !

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

No branches or pull requests

2 participants