From bb22e52d0bab2f13a11e344255dad80ddc828b1a Mon Sep 17 00:00:00 2001 From: Jeremy Kersten Date: Thu, 24 Jun 2021 13:12:31 +0000 Subject: [PATCH] [FIX] website: serve_redirect with trailing / MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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) --- addons/website/models/ir_http.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/addons/website/models/ir_http.py b/addons/website/models/ir_http.py index a7d1b313f62..5e426fc7bcf 100644 --- a/addons/website/models/ir_http.py +++ b/addons/website/models/ir_http.py @@ -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)