From 53620de6df74d058e73a512da0f2c4143340670d Mon Sep 17 00:00:00 2001 From: =?utf8?q?Thomas=20Wei=C3=9Fschuh?= Date: Wed, 17 Aug 2016 15:46:29 +0000 Subject: [PATCH] do not send an overriden language if none is set If the browser does not have any language configured `window.navigator.languages == []` and `window.navigator.language == ""`. (at least on FF) In this case an empty GET parameter is submitted to `/api/l10n/index?locale=`. This leads to a 400 Bad Request response and no language data. Therefore the navbar has no UI elements and is unusable, make login impossible. --- server/sonar-web/src/main/js/helpers/l10n.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/server/sonar-web/src/main/js/helpers/l10n.js b/server/sonar-web/src/main/js/helpers/l10n.js index 7ea46291181..425dd32674f 100644 --- a/server/sonar-web/src/main/js/helpers/l10n.js +++ b/server/sonar-web/src/main/js/helpers/l10n.js @@ -91,7 +91,10 @@ export function requestMessages () { } const bundleTimestamp = localStorage.getItem('l10n.timestamp'); - const params = { locale: currentLocale }; + const params = {}; + if (currentLocale) { + params.locale = currentLocale; + } if (bundleTimestamp !== null && checkCachedBundle()) { params.ts = bundleTimestamp; } -- 2.39.5