-
-
Notifications
You must be signed in to change notification settings - Fork 3.5k
URL Decoding in Dynamic Routes (SSR) #16313
Copy link
Copy link
Open
withastro/docs
#13903Labels
- P4: importantViolate documented behavior or significantly impacts performance (priority)Violate documented behavior or significantly impacts performance (priority)pkg: astroRelated to the core `astro` package (scope)Related to the core `astro` package (scope)
Metadata
Metadata
Assignees
Labels
- P4: importantViolate documented behavior or significantly impacts performance (priority)Violate documented behavior or significantly impacts performance (priority)pkg: astroRelated to the core `astro` package (scope)Related to the core `astro` package (scope)
Type
Fields
Give feedbackNo fields configured for issues without a type.
Astro Info
If this issue only occurs in one browser, which browser is a problem?
No response
Describe the Bug
I’m not sure whether this is a bug or a documentation issue.
The values of
Astro.urlandnew URL(Astro.request.url)are different.This seems to be related to the following change:
https://docs.astro.build/en/guides/upgrade-to/v6/#removed-percent-encoding-in-routes
However, the API reference for
Astro.urlstates:which does not match the current behavior.
Additionally, regarding
Astro.params, there is no mention of decoding in the documentation:https://docs.astro.build/en/reference/api-reference/#params
What's the expected result?
Astro.urlandnew URL(Astro.request.url)should be identical (i.e.,%25should not be decoded).Currently, the
pathnameofAstro.urlis partially decoded, which results in an invalid URL and makes it unusable for purposes such as redirects.The same issue applies to
Astro.params.It should either not be decoded at all, or if decoding is intended,
decodeURIComponentshould be used instead ofdecodeURI.Alternatively, it could be made configurable via
astro.config.Link to Minimal Reproducible Example
https://stackblitz.com/edit/github-wipyksgd?file=src%2Fpages%2Findex.astro
Participation