forked from kadirahq/flow-router
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix the url generation for prefixed paths
Fixes kadirahq#508
- Loading branch information
1 parent
182bdd3
commit 89fc983
Showing
2 changed files
with
12 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,9 @@ | ||
Router.prototype.url = function() { | ||
var path = this.path.apply(this, arguments); | ||
return Meteor.absoluteUrl(path.replace(/^\//, '')); | ||
// We need to remove the leading base path, or "/", as it will be inserted | ||
// automatically by `Meteor.absoluteUrl` as documented in: | ||
// http://docs.meteor.com/#/full/meteor_absoluteurl | ||
var completePath = this.path.apply(this, arguments); | ||
var basePath = this._basePath || '/'; | ||
var pathWithoutBase = completePath.replace(new RegExp('^' + basePath), ''); | ||
return Meteor.absoluteUrl(pathWithoutBase); | ||
}; |