Skip to content

Commit d9d2ab2

Browse files
committed
[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: 98e98f6
1 parent c9f24e2 commit d9d2ab2

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

extensions/odoo_theme/static/js/switchers.js

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,13 @@
1515
document.querySelectorAll('a[class="dropdown-item"]').forEach(element => {
1616
element.addEventListener('click', async event => {
1717
if (element.hasAttribute('href')) {
18-
event.preventDefault();
19-
const fallbackUrls = await _generateFallbackUrls(element.getAttribute('href'));
20-
const fallbackUrl = await _getFirstValidUrl(fallbackUrls);
21-
window.location.href = fallbackUrl;
18+
const targetUrl = element.getAttribute('href');
19+
if (!targetUrl.startWith('/')) { // Don't test for valid URLs if in localhost.
20+
event.preventDefault();
21+
const fallbackUrls = await _generateFallbackUrls(targetUrl);
22+
const fallbackUrl = await _getFirstValidUrl(fallbackUrls);
23+
window.location.href = fallbackUrl;
24+
}
2225
}
2326
});
2427
});

0 commit comments

Comments
 (0)