From 875b4f76a696cce11d4c09395b378d9950b315c6 Mon Sep 17 00:00:00 2001 From: Maxime Quandalle Date: Sat, 3 Oct 2015 15:28:41 +0200 Subject: [PATCH] Handle the prefixed paths in the `path` method --- client/router.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/client/router.js b/client/router.js index a485540..ba632f0 100644 --- a/client/router.js +++ b/client/router.js @@ -153,7 +153,11 @@ Router.prototype.path = function(pathDef, fields, queryParams) { return encodeURIComponent(encodeURIComponent(fields[key] || "")); }); - path = path.replace(/\/\/+/g, "/"); // Replace multiple slashes with single slash + // Prefix the path with the router global prefix + path = this._basePath + path; + + // Replace multiple slashes with single slash + path = path.replace(/\/\/+/g, "/"); // remove trailing slash // but keep the root slash if it's the only one