summaryrefslogtreecommitdiff
path: root/addons/website/static/src/js/menu
diff options
context:
space:
mode:
authorJeremy Kersten <jke@odoo.com>2020-09-24 09:53:11 +0000
committerJeremy Kersten <jke@odoo.com>2020-09-24 16:00:13 +0000
commit5fe3ad548e410fbe2eddd7f67aa4b89b81746f1a (patch)
treed95f1679316dafdbc4a5d3cf54b4d6a60c0df4f3 /addons/website/static/src/js/menu
parent5ffb7bb2f461de2b3cf95ef0df6a24b668bf9bd3 (diff)
[FIX] website: edit master wrongly computed
In case you don't have the trailing slash and are on your homepage, the indexOf will return -1 and you will be redirectected to the pathname.substr(-1) Now if you don't have trailing slash in your url after position 1, we don't subtract anything. domain.com/fr_BE Before this commit: => redirect to domain.com/E After thi comit => redirect to domain.com task-2345490 closes odoo/odoo#58457 X-original-commit: ada2e2ce68dbc8b1df701691d9d3e958fef4ea31 Signed-off-by: Jérémy Kersten (jke) <jke@openerp.com>
Diffstat (limited to 'addons/website/static/src/js/menu')
-rw-r--r--addons/website/static/src/js/menu/translate.js2
1 files changed, 1 insertions, 1 deletions
diff --git a/addons/website/static/src/js/menu/translate.js b/addons/website/static/src/js/menu/translate.js
index be5a99532e4..afb2aff2dbf 100644
--- a/addons/website/static/src/js/menu/translate.js
+++ b/addons/website/static/src/js/menu/translate.js
@@ -50,7 +50,7 @@ var TranslatePageMenu = websiteNavbarData.WebsiteNavbarActionWidget.extend({
current.href = window.location.toString();
current.search += (current.search ? '&' : '?') + 'enable_editor=1';
// we are in translate mode, the pathname starts with '/<url_code/'
- current.pathname = current.pathname.substr(current.pathname.indexOf('/', 1));
+ current.pathname = current.pathname.substr(Math.max(0, current.pathname.indexOf('/', 1)));
var link = document.createElement('a');
link.href = '/website/lang/default';