-
Notifications
You must be signed in to change notification settings - Fork 10.3k
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
Gatsby does not resolve / find unicode URLs encoded with encodeURI #16765
Comments
I'm experiencing a similar issue. I'm querying data with Japanese and Chinese content from WordPress. The URL's mostly containing foreign characters so WP encodes them automatically so they look like this: When I run So I've tried to decode the pathname before creating the page and it worked - the pages were loading fine.
But for some reason, the Gatsby Link component stopped working: When I navigate via the menu to a different page I get a white screen (no console errors) and nothing happens. But when I refresh the page it's all working fine again. Also when I visit any page from the generic development 404 page it's working just fine. |
Is it possible to give us access to a reproduction with a wordpress api? #15551 says it's working as expected. |
@wardpeet This has nothing to do with WordPress or any other CMS. Check out the steps to reproduce in the issue description. |
Hiya! This issue has gone quiet. Spooky quiet. 👻 We get a lot of issues, so we currently close issues after 30 days of inactivity. It’s been at least 20 days since the last update here. If we missed this issue or if you want to keep it open, please reply here. You can also add the label "not stale" to keep this issue open! As a friendly reminder: the best way to see this issue, or any other, fixed is to open a Pull Request. Check out gatsby.dev/contribute for more information about opening PRs, triaging issues, and contributing! Thanks for being a part of the Gatsby community! 💪💜 |
@gatsbybot @wardpeet Nope, not stale. Still happening, and the reproduction information is available in this ticket. |
Hello! Not sure if at all helpful, but I'm experiencing the same issue, although weirdly only in production and with double quotes If you try to go to this link directly (server side rendered), the site throws an error But if you go here first, and click on the first instrument, it will take you to the same url above but not throw the error. Again, not sure if at all helpful, let me know if you need more information. |
@dsegovia90 I have a similar but distinct issue to what you're reporting. TL;DR: In my case, I can navigate directly to a page with non-encoded URLs except on MS Edge. On MS Edge, I have the same symptoms of your bug - the page renders for a second, but then goes white and the |
@roadwig I believe it's a problem with Edge, not Gatsby. The whole reason I first started encoding my URLs is because Edge was failing to load them. Edit: Reading through your issue, perhaps this is indeed a problem with Gatsby. Hard to say if Gatsby is to blame or Edge. Regardless, this definitely seem related. |
Hey again! It’s been 30 days since anything happened on this issue, so our friendly neighborhood robot (that’s me!) is going to close it. Please keep in mind that I’m only a robot, so if I’ve closed this issue in error, I’m As a friendly reminder: the best way to see this issue, or any other, fixed is to open a Pull Request. Check out gatsby.dev/contribute for more information about opening PRs, triaging issues, and contributing! Thanks again for being part of the Gatsby community! |
@gatsbybot @wardpeet Still not stale, still has all the required info, and things have definitely happened on this issue in the past 30 days 😕 |
@eyalroth Your reproduction steps breaks. But what is your actual reason using Just tried as;
And this works perfect. Both staging and production. On this system;
|
Got same issue here:
When we try to access "/réseaux-sociaux", a 404 is displayed few ms before being replaced by a blank page. We also notice that every page that contains unicode character doesn't display 404 but blank page. We have built several website with Gatsby and did not face this issue few month ago. We also tried this before we found out that this issue wasn't related to the redirects, It didn't work:
|
I have this issue when using locales from Prismic - I have a slug with cyrillic characters, i.e. EDIT: I didn't read above efforts properly 🤦♂️ - I tried |
Nothing new on this? |
Nothing to do with Edge, it happens on Chrome. |
I made a test with both plain English characters and with Unicode characters, the English only characters work well, the Unicode characters don't work. Source site http://www.wpexpert.co.il/%D7%91%D7%9C%D7%95%D7%92/ Reproduction repo: https://github.com/adamgen/gatsby-wp-unicode-error-poc |
Just making sure we're on the same page here - the long weird |
I found a local fix, but I really think it should be fixed on gatsby. To make a long story short - you should use const path = require('path')
exports.createPages = ({ actions }) => {
const { createPage } = actions
createPage({
path: decodeURIComponent("/page-שלוש/"), // this is "three" in Hebrew
component: path.resolve('./src/components/page3.js'),
})
} I think that gatsby should apply |
Hiya! This issue has gone quiet. Spooky quiet. 👻 We get a lot of issues, so we currently close issues after 30 days of inactivity. It’s been at least 20 days since the last update here. Thanks for being a part of the Gatsby community! 💪💜 |
Hey again! It’s been 30 days since anything happened on this issue, so our friendly neighborhood robot (that’s me!) is going to close it. Thanks again for being part of the Gatsby community! 💪💜 |
Still an issue that should be fixed in Gatsby. |
Finding a similar issue with meta tags that have links to URLs — Twitter is not parsing any html entities in URLs where |
Having the same issue here. This is a blocker for enabling multi-lingual sites. |
Same problem here. |
@adamgen solution for Hebrew is working well |
Having the same issue! |
Still an issue; GitHub REALLY needs a way to better surface falsely-closed issues. EDIT: At the bare minimum, even if absolutely no code fix is needed (which seems unlikely), a documentation update is needed. https://www.gatsbyjs.com/docs/reference/routing/creating-routes/ doesn't even menton URI encoding/decoding, let alone explain how Gatsby expects you to handle it. EDIT 2: Similarly https://www.gatsbyjs.com/docs/reference/config-files/actions/#createPage makes no mention of encoding problems, and simply defines the
Encoded URLs (which is to say |
Following the paper trail of #17556 or #15551 some issues around MS Edge and reach/router were solved. However, this issue here is way to vague on what's actually the issue now (whether it's a specific browser issue, problem with So please open one new bug report (and others can comment on it with a reproduction) where you give a reproduction and outline where the problem lies now.
|
While all of the above comments mention actual pages that have unicode characters, a similar and easily testable issue I'm running into is accessing a purposely invalid URL with a |
I believe that due to this call (see: I agree with @machineghost that this should be documented in the Sorry to re-ignite an old issue but I think it should be addressed in some capacity. A minimal reproduction would be (with “ being a unicode character, however any unicode character should have this issue): // works
createPage({
path: `/“hmmm”`,
component: require.resolve("./src/templates/some-template.js") /* not relevant */,
context: {},
})
// doesn't work
createPage({
path: encodeURI(`/“hmmm”`),
component: require.resolve("./src/templates/some-template.js") /* not relevant */,
context: {},
}) TLDR;
|
@machineghost The docs have been updated in those two sections to reflect this limitation. Cheers for helping me find those limitations. I spent A LOT of time wondering why those URLs were coming up as 404. |
Description
Gatsby does not support pages with a path containing unicode characters and encoded with
encodeURI
. The development server (gatsby develop
) will fail to find these pages, while the production build (gatsby build
) will fail to find them if the service worker plugin (gatsby-plugin-offline
) is enabled.This was previously discussed in this issue, however it was closed by the Gatsby bot so I am reopening it, as it is a crucial bug for me.
Steps to reproduce
src/components/page3.js
:gatsby-node.js
:gatsby develop
.http://localhost:8000/page-שלוש/
orhttp://localhost:8000/page-%D7%A9%D7%9C%D7%95%D7%A9/
, and you'll see nothing comes up.gatsby-plugin-offline
ingatsby-config.js
(simply un-comment it).gatsby build && gatsby serve
.Expected result
Encoded URLs should be resolved and found correctly.
Actual result
URLs are not found.
Environment
gatsby info --clipboard
:Note that this is a WSL installation on Windows 10.0.17134.799.
The text was updated successfully, but these errors were encountered: