Comparing version 0.4.9 to 0.4.10
@@ -103,9 +103,19 @@ var ecstatic = require('../ecstatic'), | ||
var failed = false | ||
var writeRow = function (file, i) { | ||
html += '<tr><td><code>(' + perms(file[1]) + ')</code> <a href="' | ||
+ ent.encode(decodeURI( | ||
try { | ||
var decoded = decodeURI( | ||
req.url.replace(/\/$/, '') | ||
+ '/' | ||
+ file[0] | ||
)) + '">' + ent.encode(file[0]) + '</a></td></tr>\n'; | ||
); | ||
} | ||
catch (err) { | ||
failed = true; | ||
res.statusCode = 400; | ||
return res.end(err + '\n') | ||
} | ||
html += '<tr><td><code>(' + perms(file[1]) + ')</code> <a href="' | ||
+ ent.encode(decoded) | ||
+ '">' + ent.encode(file[0]) + '</a></td></tr>\n'; | ||
} | ||
@@ -125,4 +135,6 @@ | ||
res.writeHead(200, { "Content-Type": "text/html" }); | ||
res.end(html); | ||
if (!failed) { | ||
res.writeHead(200, { "Content-Type": "text/html" }); | ||
res.end(html); | ||
} | ||
} | ||
@@ -129,0 +141,0 @@ }); |
@@ -5,3 +5,3 @@ { | ||
"description": "A simple static file server middleware that works with both Express and Flatiron", | ||
"version": "0.4.9", | ||
"version": "0.4.10", | ||
"homepage": "https://github.com/jesusabdullah/node-ecstatic", | ||
@@ -8,0 +8,0 @@ "repository": { |
232970
34
1139
10