Comparing version 0.4.0 to 0.4.1
@@ -33,5 +33,11 @@ #! /usr/bin/env node | ||
// Figure out the path for the file from the given url | ||
var parsed = url.parse(req.url), | ||
pathname = decodeURI(parsed.pathname), | ||
file = path.normalize( | ||
var parsed = url.parse(req.url); | ||
try { | ||
var pathname = decodeURI(parsed.pathname); | ||
} | ||
catch (err) { | ||
return status[400](res, next, { error: err }); | ||
} | ||
var file = path.normalize( | ||
path.join(root, | ||
@@ -38,0 +44,0 @@ path.relative( |
@@ -52,1 +52,7 @@ // not modified | ||
}; | ||
// bad request | ||
exports['400'] = function (res, next, opts) { | ||
res.statusCode = 400; | ||
res.end(opts && opts.error ? String(opts.error) : 'Malformed request.'); | ||
}; |
@@ -5,3 +5,3 @@ { | ||
"description": "A simple static file server middleware that works with both Express and Flatiron", | ||
"version": "0.4.0", | ||
"version": "0.4.1", | ||
"homepage": "https://github.com/jesusabdullah/node-ecstatic", | ||
@@ -8,0 +8,0 @@ "repository": { |
224125
28
828
7