fix(router): ensure that root URL redirect doesn't redirect non-root URLs

Closes #2221
This commit is contained in:
Matias Niemelä
2015-06-15 00:45:02 -07:00
parent 3154cea0bf
commit 73d152506b
2 changed files with 32 additions and 2 deletions

View File

@ -57,8 +57,12 @@ export class RouteRecognizer {
var solutions = ListWrapper.create();
MapWrapper.forEach(this.redirects, (target, path) => {
// TODO: "/" redirect case
if (StringWrapper.startsWith(url, path)) {
// "/" redirect case
if (path == '/' || path == '') {
if (path == url) {
url = target;
}
} else if (StringWrapper.startsWith(url, path)) {
url = target + StringWrapper.substring(url, path.length);
}
});