Permalink
Browse files

fix bug where configured prefixes can be undefined

  • Loading branch information...
1 parent 31295f4 commit ea75f3aa8027e5000e7e75ebe0dde7e704ef047a @ekashida ekashida committed Mar 25, 2013
Showing with 5 additions and 5 deletions.
  1. +5 −5 lib/app/middleware/mojito-handler-tunnel-parser.js
@@ -24,18 +24,18 @@ module.exports = function (config) {
staticPrefix = appConfig.staticHandling && appConfig.staticHandling.prefix;
tunnelPrefix = appConfig.tunnelPrefix;
+ // normalize() will squash multiple slashes into one slash.
if (staticPrefix) {
staticPrefix = staticPrefix.replace(RE_TRAILING_SLASHES, '');
- staticPrefix = '/' + staticPrefix;
+ staticPrefix = libpath.normalize('/' + staticPrefix);
}
if (tunnelPrefix) {
tunnelPrefix = tunnelPrefix.replace(RE_TRAILING_SLASHES, '');
- tunnelPrefix = '/' + tunnelPrefix;
+ tunnelPrefix = libpath.normalize('/' + tunnelPrefix);
}
- // normalize() will squash multiple slashes into one slash.
- staticPrefix = libpath.normalize(staticPrefix) || '/static';
- tunnelPrefix = libpath.normalize(tunnelPrefix) || '/tunnel';
+ staticPrefix = staticPrefix || '/static';
+ tunnelPrefix = tunnelPrefix || '/tunnel';
return function (req, res, next) {
var hasTunnelPrefix = req.url.indexOf(tunnelPrefix) === 0,

0 comments on commit ea75f3a

Please sign in to comment.