Open meesvandongen opened 4 years ago
This bug is nearly a year old; if it's not going to get fixed, at the very least could someone please add some documentation saying "you can't URI encode in getStaticPaths
"?
Has there been some development on this? I am struggling to get a readable search, filter and sort query due to this issue. Is there another work around to include characters like a ',' or '+' in a query string?
It's been over a year ... and still no one has added even a single sentence anywhere in the documentation saying anything to the effect of "Next.js routes, whether dynamic or not, can't have %
characters in them." (or "can't be URI Encoded", or whatever the actual details are).
C'mon Next team: why do you hate new users of your framework so much that you can't explain how it works to them with one line of documentation? It would literally take you < 10 minutes to make the PR for this.
P.S. I would happily submit the PR myself, if I knew what the Next rules on encoding special characters in URLs actually were.
Also cannot decode url ( %20 ) in next/link . Any Idea ? Example url thor route works url the%20avengers route didn't work but path is already generated with the-avengers route so I can access with manual typing in url bar not from Link
This bug is nearly a year old; if it's not going to get fixed, at the very least could someone please add some documentation saying "you can't URI encode in
getStaticPaths
"?
What would be the workaround to this?
Ran into this issue when creating static paths based off of a set of blog post titles from my Strapi CMS.
Very frustrating. The paths without URI encoding (but still valid paths, such as /coffee) worked. Any paths that were URI encoded (containing %s), did not work. Do I have to devise a replacement strategy (ie. replace all URI-unfriendly characters with non-%s) and then undo that, and query for the correct post when in getStaticProps()?
What's the fix???
@muzucode Where are you going host this static site?
@iShelar The site is currently hosted on an EC2 instance. But I am planning to move it to Digital Ocean.
Edit: I should also mention it is not a static site. There are some static paths, but the bulk of the site is backed by Strapi CMS. The statically generated pages are created from dynamically querying all the posts in my DB that's wired up with Strapi.
Ran into this issue when creating static paths based off of a set of blog post titles from my Strapi CMS.
Very frustrating. The paths without URI encoding (but still valid paths, such as /coffee) worked. Any paths that were URI encoded (containing %s), did not work. Do I have to devise a replacement strategy (ie. replace all URI-unfriendly characters with non-%s) and then undo that, and query for the correct post when in getStaticProps()?
What's the fix???
Fwiw, this is exactly what I did.
Ran into this issue when creating static paths based off of a set of blog post titles from my Strapi CMS. Very frustrating. The paths without URI encoding (but still valid paths, such as /coffee) worked. Any paths that were URI encoded (containing %s), did not work. Do I have to devise a replacement strategy (ie. replace all URI-unfriendly characters with non-%s) and then undo that, and query for the correct post when in getStaticProps()? What's the fix???
Fwiw, this is exactly what I did.
You can make regex to allow only characters that are supported by getstaticpaths. This can be a workaround.
over 3 years now.
Bug report
Describe the bug
Paths get url-encoded when using
next export
. This causes them to get double-encoded when live.To Reproduce
test case: https://gitlab.com/meesvandongen/test-case-next-export
build & export the project, serve it and go to the relevant page:
%20
(space), giving%2520
Expected behavior
The routes are exported without encoding.
Additional context
This behaviour is different from exportPathMap, where the behaviour was as desired.