question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Permalink with accents : inconsistency between dev and build

See original GitHub issue

Let’s say I have a permalink with an accent, for exemple /salamèche. In dev mode, when I try to access the page, I get a Not Found page. When I build, I get the correct path salamèche in my public folder and I can access the page as expected.

I tried to wrap my permalink with encodeURI function. It work now in dev mode, when I build, it create the folder salam%C3%A8che but I can’t access this page (with sirv-cli), either with /salamèche or /salam%C3%A8che.

Elderjs: 1.2.4
Svelte: 3.29.0

Issue Analytics

  • State:open
  • Created 3 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
kiuKisascommented, Mar 6, 2021

I had more time to try it out, and it works indeed ! Just to recap if someone need it right now, this is the way to go:

  • add polka/url@next to your project: yarn add polka/url@next

  • add the parser to your config in src/server.js:

const parser = require('@polka/url');
server.parse = (req) => parser(req, true);
0reactions
lukeedcommented, Jan 11, 2021

Just to confirm – that should be the fix since Polka is setting req.path which sirv then respects & uses, preventing its own decode.

Your directory name should contain the special characters. It worked in dev because your filesystem also contained the special characters, but the in-memory FILES cache of sirv possessed keys like /salamèche, but the req.path was sending the still-encoded /salam%C3%A8che form.

Read more comments on GitHub >

github_iconTop Results From Across the Web

No results found

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found