diff options
| author | Romain Derie <rde@odoo.com> | 2019-10-08 14:16:21 +0000 |
|---|---|---|
| committer | fw-bot <otis@odoo.com> | 2019-10-08 16:54:07 +0000 |
| commit | f4105eb9c7010f8693e5d2fd20c0bd9d9cc2e483 (patch) | |
| tree | 37018764f10206cd97f4d37cc843c8de5ccd3155 | |
| parent | f53e751433fa66ae2880a6ddefa44ee1fa93bae8 (diff) | |
[FIX] website: prevent endless loop if homepage is unpublished..
.. and first menu is a container with # as url.
There is a particular case where the / url would loop endlessly.
1. Unpublished the homepage /
2. Edit the menu so the first menu is a container. There is a hint telling you
a container menu should have its URL set to `#` as a good practice.
3. This will lead to endless loop for public user as the code will check if the
homepage can be accessed. Since it is unpublished, it will then fallback on
the first menu which is not '/' and redirect to it.
Sadly, the code was not expecting `#` to be handled as `/`.
opw-2081969
closes odoo/odoo#38234
X-original-commit: cff11bdb66f1dda41cf333a28b67df7ef20a3de9
Signed-off-by: Romain Derie (rde) <rde@odoo.com>
| -rw-r--r-- | addons/website/controllers/main.py | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/addons/website/controllers/main.py b/addons/website/controllers/main.py index e1252e0e23b..5bb0f610500 100644 --- a/addons/website/controllers/main.py +++ b/addons/website/controllers/main.py @@ -77,7 +77,7 @@ class Website(Home): else: top_menu = request.website.menu_id first_menu = top_menu and top_menu.child_id and top_menu.child_id.filtered(lambda menu: menu.is_visible) - if first_menu and first_menu[0].url not in ('/', '') and (not (first_menu[0].url.startswith(('/?', '/#', ' ')))): + if first_menu and first_menu[0].url not in ('/', '', '#') and (not (first_menu[0].url.startswith(('/?', '/#', ' ')))): return request.redirect(first_menu[0].url) raise request.not_found() |
