apostrophecms / apostrophe

A full-featured, open-source content management framework built with Node.js that empowers organizations by combining in-context editing and headless architecture in a full-stack JS environment.
https://apostrophecms.com
Other
4.36k stars 590 forks source link

Pages titles with special characters (diacritics) cannot be previewed when saved as a draft #3488

Closed ObscurusGrassator closed 2 years ago

ObscurusGrassator commented 3 years ago

When using special characters(diacritic f.e. šččťžžý) in page title of a new page and saving it as draft we get an error: "We're sorry. We couldn't find the page you're looking for."

Apostrophe 3.6.0 Node v16.9.1 Mac + Linux + Windows

abea commented 3 years ago

Can you provide specific steps to reproduce this? I'm able to create a page using those characters.

Screen Shot 2021-10-15 at 10 43 59 AM

ObscurusGrassator commented 3 years ago
Snímka obrazovky 2021-10-15 o 18 29 25 Snímka obrazovky 2021-10-15 o 18 30 18
abea commented 3 years ago

Okay, so this only seems to happen when the page is unpublished -- only saved as a draft and previewed. In the short term you can manually edit the slug field to not include diacritics. We will log this to work on a fix. I'm not sure when it will be prioritized, so we'll welcome contributions.

boutell commented 3 years ago

Hmm, in that situation Apostrophe's serveNotFound method kicks in and checks if the desired slug does exist as a draft page, and if so redirects there. Perhaps that logic has a problem with diacritics, although I don't know why; that's the right place to look though.

(Worth making sure it still works for ordinary slugs too!)

On Fri, Oct 15, 2021 at 12:56 PM Alex Bea @.***> wrote:

Okay, so this only seems to happen when the page is unpublished -- only saved as a draft and previewed.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/apostrophecms/apostrophe/issues/3488#issuecomment-944452227, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAAH27OATBW3IFYAGPB5RDTUHBMM3ANCNFSM5GBWR4UQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

--

THOMAS BOUTELL | CHIEF TECHNOLOGY OFFICER APOSTROPHECMS | apostrophecms.com | he/him/his

robinpokorny commented 3 years ago

Looked into it. The problem is with URL decoding.

Express automatically decodes the values in req.params (using decodeURIComponent). In the serveNotFound function new params are constructed from req.path which is not decoded.

boutell commented 3 years ago

Good diagnosis! Would you be interested in doing a PR?