diff --git a/CHANGELOG.md b/CHANGELOG.md index 8e40e8a..c14ab54 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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) @@ -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()` @@ -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` diff --git a/lib/router.js b/lib/router.js index 0c05a2d..efcd20b 100644 --- a/lib/router.js +++ b/lib/router.js @@ -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: