Comment fetching is case-sensitive with URL-encoded national characters
I have a website with pages having Cyrillic in URLs, which obviously gets URL-encoded.
Browsers and web servers treat hex codes in %-encoded characters case-insensitively, so that
%d0%be%d0%b1 are equivalent and lead to the same page.
This isn't the case with Commento, when
commento.js sends the current page's URL to the backend. Then, depending on the character case, it does or doesn't find comments.
Example of equivalent URLs:
- With comments (scroll to the bottom of page): https://yktoo.com/ru/blog/post/2019/08/16-%D0%BE%D0%B1%D0%BD%D0%BE%D0%B2%D0%B8%D1%82%D0%B5-%D1%81%D1%81%D1%8B%D0%BB%D0%BA%D0%B8-%D0%BD%D0%B0-rss-%D1%81%D0%B0%D0%B9%D1%82-%D0%BE%D0%B1%D0%BD%D0%BE%D0%B2%D0%BB%D1%8F%D0%B5%D1%82%D1%81%D1%8F/
- No comments: https://yktoo.com/ru/blog/post/2019/08/16-%d0%be%d0%b1%d0%bd%d0%be%d0%b2%d0%b8%d1%82%d0%b5-%d1%81%d1%81%d1%8b%d0%bb%d0%ba%d0%b8-%d0%bd%d0%b0-rss-%d1%81%d0%b0%d0%b9%d1%82-%d0%be%d0%b1%d0%bd%d0%be%d0%b2%d0%bb%d1%8f%d0%b5%d1%82%d1%81%d1%8f/
Expected behaviour: comments are always displayed.
I see two-and-a-half ways of how this can be solved:
- The backend performs URL decoding, stores the complete Unicode URL in the DB and uses it for future matching
- The backend or the frontend transforms hex in %-chars to a consistent case (keeping the case of regular chars, of course)
- Or this can be somewhat mitigated by implementing my other suggestion (#199) about adding the
PS. The worst thing here is that Gmail, for example, converts links in Commento's notification emails into lowercase. So you click on the topic name or "CONTEXT" and get to see a page with no comments on it, terribly confusing.