Permalink
Browse files

fix(router): getBaseUrl() to return correct URL for encodable chars

decode fragment so path can be found and return encoded URL
  • Loading branch information...
jagonalez committed May 4, 2017
1 parent ac6bf75 commit 0ef12f6ea5af6a13c901d64f695a4e5cbb9f2139
Showing with 3 additions and 4 deletions.
  1. +3 −4 src/navigation-instruction.js
@@ -162,7 +162,7 @@ export class NavigationInstruction {
* Gets the instruction's base URL, accounting for wildcard route parameters.
*/
getBaseUrl(): string {
let fragment = this.fragment;
let fragment = decodeURI(this.fragment);
if (fragment === '') {
let nonEmptyRoute = this.router.routes.find(route => {
@@ -175,7 +175,7 @@ export class NavigationInstruction {
}
if (!this.params) {
return fragment;
return encodeURI(fragment);
}
let wildcardName = this.getWildCardName();
@@ -185,8 +185,7 @@ export class NavigationInstruction {
return fragment;
}
path = encodeURI(path);
return fragment.substr(0, fragment.lastIndexOf(path));
return encodeURI(fragment.substr(0, fragment.lastIndexOf(path)));
}
_commitChanges(waitToSwap: boolean) {

0 comments on commit 0ef12f6

Please sign in to comment.