Skip to content

Commit

Permalink
Fix: History did not handle outbound absolute paths correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
rluba committed Jun 1, 2018
1 parent bfad456 commit 407959e
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -124,9 +124,19 @@ export class BrowserHistory extends History {
* @return Promise if triggering navigation, otherwise true/false indicating if navigation occured.
*/
navigate(url?: string, {trigger = true, replace = false} = {}): Promise|boolean {
if (url && absoluteUrl.test(url)) {
this.location.href = url;
return true;
if (url) {
let isOutbound = false;
if (absoluteUrl.test(url)) {
isOutbound = true;
} else if (this._hasPushState && url.indexOf('/') === 0 && url.indexOf(this.root) !== 0) {
// Absolute path with a different root
isOutbound = true;
}

if (isOutbound) {
this.location.href = url;
return true;
}
}

if (!this._isActive) {
Expand Down

0 comments on commit 407959e

Please sign in to comment.