Skip to content

Commit

Permalink
[chrome/urlOverflowCheck] use modifyUrl helper (#22435)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Spencer committed Aug 28, 2018
1 parent 36a922e commit 925e13f
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/ui/public/chrome/api/angular.js
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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();
}
};

Expand Down

0 comments on commit 925e13f

Please sign in to comment.