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 94a184d commit 4837940
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 5 deletions.
10 changes: 8 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,12 @@
* Add initial SSR support
* It's implemented as extendable manner. Currently ReactLayout supports it.

### v2.10.1
* 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

### v2.9.0
* Add FlowRouter.url() See: [#374](https://github.com/kadirahq/flow-router/pull/374)

Expand All @@ -83,7 +89,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 @@ -119,7 +125,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
11 changes: 8 additions & 3 deletions lib/router.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,14 @@ SharedRouter = class {
return new Group(this, options);
}

url() {
const path = this.path(...arguments);
return Meteor.absoluteUrl(path.replace(/^\//, ''));
url(...args) {
// 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
const completePath = this.path(...args);
const basePath = this._basePath || '/';
const pathWithoutBase = completePath.replace(RegExp(`^${basePath}`), '');
return Meteor.absoluteUrl(pathWithoutBase);
}

// For client:
Expand Down

0 comments on commit 4837940

Please sign in to comment.