summaryrefslogtreecommitdiff
path: root/routes
diff options
context:
space:
mode:
authorTrygve Laugstøl <trygvis@inamo.no>2012-07-18 11:43:39 +0200
committerTrygve Laugstøl <trygvis@inamo.no>2012-07-18 11:43:39 +0200
commit919af48c9db5bd53149cb9d9e23378282d1ac9ce (patch)
tree2f4f0ee5680fa3b64d4b6d2cf893894a30f746ea /routes
parent0859091a11d28dfae483bdbf9b85da83a5e21806 (diff)
downloadcollection-json-explorer-919af48c9db5bd53149cb9d9e23378282d1ac9ce.tar.gz
collection-json-explorer-919af48c9db5bd53149cb9d9e23378282d1ac9ce.tar.bz2
collection-json-explorer-919af48c9db5bd53149cb9d9e23378282d1ac9ce.tar.xz
collection-json-explorer-919af48c9db5bd53149cb9d9e23378282d1ac9ce.zip
o Trying to get the last slash correct in the URLs.
Diffstat (limited to 'routes')
-rw-r--r--routes/index.js6
1 files changed, 6 insertions, 0 deletions
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;