diff --git a/product/ERP5/bootstrap/erp5_xhtml_style/SkinTemplateItem/portal_skins/erp5_xhtml_style/Base_doLanguage.py b/product/ERP5/bootstrap/erp5_xhtml_style/SkinTemplateItem/portal_skins/erp5_xhtml_style/Base_doLanguage.py index 65c6038df41348d10cdc9783c14b4611a06fb90a..4f97365832f4a281ac7d16195fab97c46ffc408b 100644 --- a/product/ERP5/bootstrap/erp5_xhtml_style/SkinTemplateItem/portal_skins/erp5_xhtml_style/Base_doLanguage.py +++ b/product/ERP5/bootstrap/erp5_xhtml_style/SkinTemplateItem/portal_skins/erp5_xhtml_style/Base_doLanguage.py @@ -17,7 +17,8 @@ if website is not None and website.isStaticLanguageSelection(): re.escape(root_website_url), '|'.join('/' + re.escape(x) for x in root_website.getAvailableLanguageList())) referer_url = context.REQUEST.HTTP_REFERER - if referer_url: + topmost_url_document = context.Base_getURLTopmostDocumentValue() + if referer_url and topmost_url_document.isURLAncestorOf(referer_url): if select_language == default_language: redirect_url = re.sub(website_url_pattern, root_website_url + r'\1', referer_url) else: