[FIX] website: serve_redirect with trailing /

Before to search if a redirect exists, we try to match a page via serve_page.
But this one redirect without the trailing /. So if none page is found, we
look for redirection, but we need to search with and without this trialing /.

opw-2527063

closes odoo/odoo#72847

X-original-commit: df6f92f1c290276fed8d0643315cc0973f3729e5
Signed-off-by: Jérémy Kersten (jke) <jke@openerp.com>
This commit is contained in:
Jeremy Kersten
2021-06-28 09:51:48 +00:00
parent a7984f484b
commit bb22e52d0b
+2 -1
View File
@@ -326,7 +326,8 @@ class Http(models.AbstractModel):
req_page = request.httprequest.path
domain = [
('redirect_type', 'in', ('301', '302')),
('url_from', '=', req_page)
# trailing / could have been removed by server_page
'|', ('url_from', '=', req_page.rstrip('/')), ('url_from', '=', req_page + '/')
]
domain += request.website.website_domain()
return request.env['website.rewrite'].sudo().search(domain, limit=1)