From 919af48c9db5bd53149cb9d9e23378282d1ac9ce Mon Sep 17 00:00:00 2001 From: Trygve Laugstøl Date: Wed, 18 Jul 2012 11:43:39 +0200 Subject: o Trying to get the last slash correct in the URLs. --- routes/index.js | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'routes') diff --git a/routes/index.js b/routes/index.js index b7ec0c4..702ec0f 100644 --- a/routes/index.js +++ b/routes/index.js @@ -25,8 +25,14 @@ function split(str) { } }); + // Append the query as a single segment + // If not query, append the slash slash if it's missing. if(u.search) { splits.push([(u.pathname.match(/\/$/) ? '/' : '') + u.search, url.format(u)]); + } else if(str.match(/\/$/)) { + var last = splits[splits.length - 1]; + last[0] = last[0] + '/'; + last[1] = last[1] + '/'; } return splits; -- cgit v1.2.3