From 687b993cd29bc08808f22c943690baa915baae0a Mon Sep 17 00:00:00 2001 From: nlachat-compassion Date: Tue, 8 Oct 2024 08:05:34 +0200 Subject: [PATCH] T1835 Fix redirect loop for /child/ (#50) * Fix redirect loop for /child/ * Fix line length for pre-commit --- website_sponsorship/controllers/main.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/website_sponsorship/controllers/main.py b/website_sponsorship/controllers/main.py index 2830d4d..a638a06 100644 --- a/website_sponsorship/controllers/main.py +++ b/website_sponsorship/controllers/main.py @@ -93,7 +93,16 @@ def load_child(self, **kwargs): @http.route( [ - "/child//", + # [T1835] : Note: the route MUST be specified *without* a trailing + # "/" otherwise when a child with a given id does not exist, the 404 + # Not Found page is not displayed and instead we get an infinite + # redirect loop. The root cause is that specifying a path with a + # trailing "/" adds the "/" to the path, and then ir_http.py + # (https://github.com/odoo/odoo/blob/ + # f2765d2cab5671a010404c36842bf1b4c4d6350b/addons/website/models + # /ir_http.py#L265) redirects to a version without the "/", creating + # the infinite loop. + "/child/", ], type="http", auth="public",