Repository navigation
fix: decode URI-encoded slugs for non-ASCII URL support - #115
Conversation
Slugs containing non-ASCII characters (e.g. Telugu, Hindi, CJK) are percent-encoded by browsers when requested. Astro.params.slug can return the encoded form, causing database lookups to fail with a 404. Apply decodeURIComponent() to all [slug].astro pages across templates and demos so non-Latin slugs resolve correctly. Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
|
Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
|
All contributors have signed the CLA ✍️ ✅ |
|
Changeset added in 3c6f9dd — patch bump for all 9 affected packages. |
ascorbic
left a comment
There was a problem hiding this comment.
I wonder if we should export a helper to do this, instead of repeating the same code everywhere
| "@emdash-cms/demo-cloudflare": patch | ||
| "@emdash-cms/playground": patch | ||
| "emdash-plugins-demo": patch | ||
| "@emdash-cms/demo-postgres": patch | ||
| "@emdash-cms/demo-preview": patch | ||
| "emdash-demo": patch | ||
| "@emdash-cms/template-blog-cloudflare": patch | ||
| "@emdash-cms/template-blog": patch | ||
| "@emdash-cms/template-portfolio-cloudflare": patch |
There was a problem hiding this comment.
These are all private packages that aren't published to npm, so don't need a changeset
Overlapping PRsThis PR modifies files that are also changed by other open PRs:
This may cause merge conflicts or duplicated work. A maintainer will coordinate. |
@emdash-cms/admin
@emdash-cms/auth
@emdash-cms/blocks
@emdash-cms/cloudflare
emdash
create-emdash
@emdash-cms/gutenberg-to-portable-text
@emdash-cms/x402
@emdash-cms/plugin-ai-moderation
@emdash-cms/plugin-atproto
@emdash-cms/plugin-audit-log
@emdash-cms/plugin-color
@emdash-cms/plugin-embeds
@emdash-cms/plugin-forms
@emdash-cms/plugin-webhook-notifier
commit: |
Export a shared decodeSlug() utility from the core package instead of repeating inline decodeURIComponent() in every [slug].astro file. Remove changeset since affected packages are all private/unpublished. Addresses review feedback from @ascorbic on PR #115. Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
|
Hi @ascorbic, thanks for the review! I've addressed your feedback:
Just a heads up — I'm not a developer by trade, I'm using Claude to help me contribute. I really wanted this feature for non-ASCII URL support and thought I'd try to help out. This is my first time sending a pull request, so please excuse any mistakes! Happy to make further changes if needed. |
|
Hey @Hari-Bonda! This has become conflicted. I'd like to get it in, but it has become conflicted with the main branch. Could you resolve conflicts and we'll get it in. |
Resolve import conflicts where our branch added `decodeSlug` and upstream added `getSiteSettings` — both imports are kept. Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
|
Hi @ascorbic, thanks for the heads up! I've resolved the merge conflicts with main — the conflicts were in 6 template files where the Ready for another look whenever you get a chance. Thank you for your patience and for helping guide this PR! |
|
Thanks! Can you also sign the CLA (see the comment above) |
|
I have read the CLA Document and I hereby sign the CLA |
* fix: decode URI-encoded slugs for non-ASCII URL support Slugs containing non-ASCII characters (e.g. Telugu, Hindi, CJK) are percent-encoded by browsers when requested. Astro.params.slug can return the encoded form, causing database lookups to fail with a 404. Apply decodeURIComponent() to all [slug].astro pages across templates and demos so non-Latin slugs resolve correctly. Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]> * add changeset for decode-uri-slug fix Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]> * refactor: extract decodeSlug helper and remove changeset Export a shared decodeSlug() utility from the core package instead of repeating inline decodeURIComponent() in every [slug].astro file. Remove changeset since affected packages are all private/unpublished. Addresses review feedback from @ascorbic on PR emdash-cms#115. Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]> --------- Co-authored-by: Claude Opus 4.6 (1M context) <[email protected]> Co-authored-by: Matt Kane <[email protected]>
What does this PR do?
Slugs containing non-ASCII characters (e.g. Telugu, Hindi, CJK) are percent-encoded by browsers when requested (e.g.
మేష-రాసిbecomes%e0%b0%ae%e0%b1%87%e0%b0%b7-%e0%b0%b0%e0%b0%be%e0%b0%b8%e0%b0%bf).Astro.params.slugcan return the encoded form on Cloudflare Workers, causing database lookups to fail with a 404.Applied
decodeURIComponent()to all[slug].astropages across all templates and demos (39 files).Reproduction
మేష-రాసి)Fix
This ensures the slug is decoded before being used in database queries, so non-Latin URLs resolve correctly.
Type of change
Checklist
pnpm typecheckpassespnpm lintpassespnpm testpasses (or targeted tests for my change)pnpm formathas been runpnpm locale:extracthas been run (if applicable)AI-generated code disclosure
Screenshots / test output
🤖 Generated with Claude Code