Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[FIX] website: redirect to case insensitive URL if not exact match
Before this commit, if a link to a page was not correct because of a case mismatch, it would simply land on a 404 page. While it's correct, as URL are case sensitive, it leads to a few bad UX flow at the admin/editor level: - Create a link in your page (on a text or a button eg), type an URL which does not exists (to create it after) like /Page - Click on the link/button you just made, you are redirected to /Page which display a 404 with the "Create page" option (correct) - When you click on that button, it will actually create a page with /page URL, leading to a mismatch between the URL you created and the page URL. Your link/button will still lead to a 404 URL as it points to /Page. Since it's just a fallback when an exact URL match is not found, it should not break anything and should not have bad impact at any level (seo/speed etc). Indeed: - It's done through a 302 redirect - `_serve_page()` is already a fallback case, so it will only make the `website.redirect` and 404 cases a bit slower due to the extra search query. The only possible scenario seems to be if the user (mind the uppercase): - Created a /Page page - Created a redirect from /page to /another-page In this case, /page won't land on /another-page but on /Page. This flow seems unlikely and is not actually wrong either way. At least, it certainly is less important than ensuring a case insensitive fallback. Finally, note that another solution would have been to either: - Force page URL to lower case. -> This is not stable friendly, people might be relying on this to create pages with different casing: `/Batman-VII-The-Dark-Knight-Whatevers`, while not recommended, doesn't sounds idiot. On top of not being stable friendly, we probably want to keep offering this possibility - Redirect all URLs to lowercase endpoints. -> This is obviously not stable and not Odoo's jobs. It should be something decided by the sysadmin and done at nginx (etc) level. task-3110294 opw-3104030 closes odoo#109812 Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
- Loading branch information