-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Routing error when navigating to path that includes an encoded forward slash #7962
Comments
Shouldn't you be using [...slug].astro if you want to go nested paths? |
@svensigmond Did you get a look at my comment? |
Hello @rishi-raj-jain, I had missed your comment. We resolved the issue internally by changing the value of the id in the url, but I did give your solution a spin in the stackblitz example. Using For example lets say I would like to go to a url like this: http://example.com/currencies/eur%2Fusd/details. This would not be possible if I understand the rest parameter slugs in Astro correctly, because it would treat everything after currencies as To summarize, yes using the rest parameters in the slug does fix the stack blitz example, but merely hides the fact that using encoded forward slashes with Astro is broken. (unless this is by design and I missed this information in the documentation). |
any news on this one? |
The expectation is a bit unclear to me. What should be the value |
looks like it should be 'eur/usd' inside Astro.params. as it is "eur%2Fusd" in the URL. encountered the same issue myself, with diffrent types of values. |
@yuvalsade is correct @ematipico. I wanted to use <a href={ |
I'm also experiencing this one. |
This may be fixed by #12079 |
The PR does not fix it |
We do not plan to support this usecase. Here, looks like you need 2 params instead, that could be |
Hey
The use case isn't about separation of parameters. It's about correct
encoding/decoding of '/' character within a value of a single parameter.
Right now encoded '/', cannot be used within a path value.
For example, let's take a query string parameter. If you encode '&'
character, it's legal to be used within a query string value. Otherwise
it's a separator.
Therefore it's bug fix request, not a requested feature.
it should be handled like every other router. E.g: path.split('/'), then
urldecode each value. Hope it clarifies the issue.
I didn't check the code, but it feels like there is an extra urldecode
there.
Thank you.
בתאריך יום ב׳, 7 באוק׳ 2024, 16:53, מאת Florian Lefebvre <
***@***.***>:
… We do not plan to support this usecase. Here, looks like you need 2 params
instead, that could be /[from]/[to] or /[from]- [to]
—
Reply to this email directly, view it on GitHub
<#7962 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ACXEKHF2QNV7UDTL2XTOFBLZ2KG63AVCNFSM6AAAAABPHOSZ4CVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGOJXGAYDCNBVGI>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
I'm glad to bring some good news. This will be supported in Astro v5. You can check it out in |
hi @ematipico, I checked out the stackblitz example you linked and I still get an error when navigating to the page with the link on the index page: It is slightly different from the error in my original stackblitz example, but an error nonetheless: |
@svensigmond I suggest providing a reproduction. The initial reproduction uses a very outdated version of Astro |
Hi @ematipico I have taken another look at the repo you posted at Oct. 9. There seems to be an error in At lines |
What version of
astro
are you using?2.10.1
Are you using an SSR adapter? If so, which one?
None
What package manager are you using?
npm
What operating system are you using?
Windows
What browser are you using?
Firefox
Describe the Bug
Given this folder structure:
When navigating to a route with an encoded forward slash, for example:
http://foo.com/currencies/eur%2Fusd
, the server returns a type error:This bug seems to have been introduced in the update from version 2.8.4 to 2.8.5.
It is possible to reach the slugged page in version 2.8.4, although the id will not be present in
Astro.params
, which will return an empty object instead of and object containing the id and value for the slug.Please see the repo on Stackblitz and click the link on the home page to see the error.
What's the expected result?
I would expect to be able to navigate to urls that have been encoded using
encodeURI()
orencodeURIComponent()
. I also expect these url params to be present inAstro.params
.Link to Minimal Reproducible Example
https://stackblitz.com/edit/github-mt9ply
Participation
The text was updated successfully, but these errors were encountered: