From ae8cbe35d22d0d3f18068242ee72a420c4d00d4f Mon Sep 17 00:00:00 2001 From: Spencer Date: Wed, 29 Aug 2018 12:29:09 -0700 Subject: [PATCH] [chrome/urlOverflowCheck] use `modifyUrl` helper (#22435) (#22477) Fixes #18835 This updates the url-overflow redirect to use the `modifyUrl()` helper which was written almost exclusively to help deal with the confusion that node's `path` and `pathname` nonsense creates. I tested this in Edge and things seem to work well, but I'd appreciate if @baracudda or @chandanpal could checkout this PR and see if it works for them. --- src/ui/public/chrome/api/angular.js | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/ui/public/chrome/api/angular.js b/src/ui/public/chrome/api/angular.js index f043950972f607..19fcfa410f2482 100644 --- a/src/ui/public/chrome/api/angular.js +++ b/src/ui/public/chrome/api/angular.js @@ -19,7 +19,7 @@ import React, { Fragment } from 'react'; import _ from 'lodash'; -import { format as formatUrl, parse as parseUrl } from 'url'; +import { modifyUrl } from 'ui/url'; import { uiModules } from '../../modules'; import { toastNotifications } from '../../notify'; @@ -97,10 +97,11 @@ export function initAngularApi(chrome, internals) { }); } } catch (e) { - const { host, path, search, protocol } = parseUrl(window.location.href); - // rewrite the entire url to force the browser to reload and - // discard any potentially unstable state from before - window.location.href = formatUrl({ host, path, search, protocol, hash: '#/error/url-overflow' }); + window.location.href = modifyUrl(window.location.href, parts => { + parts.hash = '#/error/url-overflow'; + }); + // force the browser to reload to that Kibana's potentially unstable state is unloaded + window.location.reload(); } };