Skip to content

Commit

Permalink
BUG: This line make paperboy return 403 forbidden in node for windows
Browse files Browse the repository at this point in the history
FIX: Check not only "/", as too "\"
  • Loading branch information
sidneyfilho committed Aug 5, 2011
1 parent f2b5d7f commit 221692a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/paperboy.js
Expand Up @@ -10,7 +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 (webroot[webroot.length - 1] !== '/') webroot += '/';
if (/\/|\\$/.test(webroot[webroot.length - 1])) webroot += '/';
if (fp.substr(0, webroot.length) != webroot)
return(['Permission Denied', null]);
else
Expand Down

0 comments on commit 221692a

Please sign in to comment.