From f165b8265219e27c2378f89485d7953a138e590e Mon Sep 17 00:00:00 2001 From: Nathan Reese Date: Mon, 8 Apr 2019 13:59:02 -0600 Subject: [PATCH] allow URLs with no hash in chrome locationChangeStart callback --- src/legacy/ui/public/chrome/directives/kbn_chrome.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/legacy/ui/public/chrome/directives/kbn_chrome.js b/src/legacy/ui/public/chrome/directives/kbn_chrome.js index 7d7f703ccc8805..464b852c3981dd 100644 --- a/src/legacy/ui/public/chrome/directives/kbn_chrome.js +++ b/src/legacy/ui/public/chrome/directives/kbn_chrome.js @@ -77,7 +77,11 @@ export function kbnChromeProvider(chrome, internals) { $rootScope.$on('$locationChangeStart', (e, newUrl) => { // This handler fixes issue #31238 where browser back navigation // fails due to angular 1.6 parsing url encoded params wrong. - const absUrlHash = url.parse($location.absUrl()).hash.slice(1); + const absUrl = url.parse($location.absUrl()); + if (!absUrl.hash) { + return; + } + const absUrlHash = absUrl.hash.slice(1); const decodedAbsUrlHash = decodeURIComponent(absUrlHash); const hash = url.parse(newUrl).hash.slice(1); const decodedHash = decodeURIComponent(hash);