Permalink
Browse files

BUG: This line make paperboy return 403 forbidden in node for windows

FIX: Check not only "/", as too "\"
  • Loading branch information...
1 parent d4b5eb5 commit 83d757eda0389c7289f3a6603b0b9c1c9c0b853c sidneyfilho committed Aug 5, 2011
Showing with 1 addition and 2 deletions.
  1. +1 −2 lib/paperboy.js
View
@@ -10,8 +10,7 @@ exports.filepath = function (webroot, url) {
// Append index.html if path ends with '/'
fp = path.normalize(path.join(webroot, (url.match(/\/$/)=='/') ? url+'index.html' : url));
// Sanitize input, make sure people can't use .. to get above webroot
- if (/\/|\\$/.test(webroot[webroot.length - 1])) webroot += '/';
-
+ if (!/\/|\\$/.test(webroot[webroot.length - 1])) { webroot = path.normalize(webroot + '/'); }
if (fp.substr(0, webroot.length) != webroot)
return(['Permission Denied', null]);
else

0 comments on commit 83d757e

Please sign in to comment.