-
-
Notifications
You must be signed in to change notification settings - Fork 8.8k
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
fix: sanitize some slugs that are React router dynamic routes #6510
base: main
Are you sure you want to change the base?
Conversation
✔️ [V2] 🔨 Explore the source changes: 40661d0 🔍 Inspect the deploy log: https://app.netlify.com/sites/docusaurus-2/deploys/61f61ab419a5ef0008d3337c 😎 Browse the preview: https://deploy-preview-6510--docusaurus-2.netlify.app |
⚡️ Lighthouse report for the changes in this PR:
Lighthouse ran on https://deploy-preview-6510--docusaurus-2.netlify.app/ |
Size Change: +3.37 kB (0%) Total Size: 759 kB
ℹ️ View Unchanged
|
✔️ [V2] 🔨 Explore the source changes: f747849 🔍 Inspect the deploy log: https://app.netlify.com/sites/docusaurus-2/deploys/61f61c186e1f8a0008ce37d9 😎 Browse the preview: https://deploy-preview-6510--docusaurus-2.netlify.app |
I have one concern with such change, because we should probably have distinct logic for 2 cases:
Are Afaik ReactRouter is using https://github.com/pillarjs/path-to-regexp I'd like to understand how other SSGs handle those cases before taking a decision on what is best for Docusaurus |
They are not illegal slugs by the URL spec, but React router interprets them as a regex capturing group. So if you have a page with slug |
But is it the case with Gatsby / Next.js / Remix too? that's worth double-checking and try to conform to what they do, particularly if someday we want to use another SSG as the underlying framework behind Docusaruus |
Motivation
Fix #5418. Not sure if this should be breaking change, since these paths probably can't be resolved previously anyways...
Have you read the Contributing Guidelines on pull requests?
Yes
Test Plan
Unit tests + dogfooding