Skip to content

Commit

Permalink
Fix the url generation for prefixed paths
Browse files Browse the repository at this point in the history
  • Loading branch information
mquandalle committed Feb 1, 2016
1 parent 182bdd3 commit 89fc983
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
7 changes: 5 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Changelog

### next
* Fix the url generation for prefixed paths. See: [#508](https://github.com/kadirahq/flow-router/issues/508)

### v2.10.0
* Update few dependencies to the latest versions: pagejs, qs, cosmos:browserify

Expand All @@ -17,7 +20,7 @@

### v2.6.1

* Fix [#143](https://github.com/kadirahq/flow-router/issues/314).
* Fix [#143](https://github.com/kadirahq/flow-router/issues/314).
This says that when we are doing a trigger redirect,
We won't get reactive changes like: `getRouteName()`

Expand Down Expand Up @@ -53,7 +56,7 @@
* Use pagejs.redirect() for our redirection process.
* Above fixes [#239](https://github.com/kadirahq/flow-router/issues/239)

### v2.0.0
### v2.0.0

* Released 2.0 :)
* Now flow-router comes as `kadira:flow-router`
Expand Down
9 changes: 7 additions & 2 deletions lib/router.js
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);
};

0 comments on commit 89fc983

Please sign in to comment.