GitbookIO / GitbookIO/gitbook

Percent-encoding parts of URL leads to a 404

Open
#3,884 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug triage
Dominant language
TypeScript
Stars
29k
Forks
4k
Avg merge
1d 2h
Merged PRs (30d)
71

Description

Bug description

URLs with percent-encoded characters are not resolved properly. They lead to a 404 page even though the canonical page exists.

How to reproduce

  1. Find a working GitBook URL, e.g. https://gitbook.com/docs/getting-started/quickstart
  2. Percent encode one or more characters in the URL path, e.g. https://gitbook.com/docs/getting-started/quickstar%74
  3. Notice that the page gives a 404 "Page not found" error, and that your browser has correctly folded the URL in the address bar to the canonical form (but it still requests the %-encoded form from the server!)

Additional context

Docs: https://developer.mozilla.org/en-US/docs/Glossary/Percent-encoding

Although it's strange to percent-encode non-reserved characters, it's still part of the standard. I found it useful for making links to pages with - characters, as they break automatic URL creation in Microsoft Word references, while %2d works as expected on most websites.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the issue with the canonical GitBook URL and the percent-encoded path shown in the report, then compare the two requests. Use the linked MDN percent-encoding reference to confirm the expected behavior. Done means encoded non-reserved characters resolve to the existing canonical page instead of returning a 404.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
web-dev
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.