[FIX] odoo_theme: stop testing for valid URLs if in localhost
The mechanism that makes the version and language switchers test for
valid URLs crashed when testing in localhost. The mechanism is now
skipped if the URL starts with a '/'.
X-original-commit: 98e98f65c9
This commit is contained in:
parent
ac3b5349f9
commit
44a025babf
@ -15,10 +15,13 @@
|
||||
document.querySelectorAll('a[class="dropdown-item"]').forEach(element => {
|
||||
element.addEventListener('click', async event => {
|
||||
if (element.hasAttribute('href')) {
|
||||
event.preventDefault();
|
||||
const fallbackUrls = await _generateFallbackUrls(element.getAttribute('href'));
|
||||
const fallbackUrl = await _getFirstValidUrl(fallbackUrls);
|
||||
window.location.href = fallbackUrl;
|
||||
const targetUrl = element.getAttribute('href');
|
||||
if (!targetUrl.startWith('/')) { // Don't test for valid URLs if in localhost.
|
||||
event.preventDefault();
|
||||
const fallbackUrls = await _generateFallbackUrls(targetUrl);
|
||||
const fallbackUrl = await _getFirstValidUrl(fallbackUrls);
|
||||
window.location.href = fallbackUrl;
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user