From 18684bccb4257f7194830054393129a39458c2dc Mon Sep 17 00:00:00 2001 From: zhangyijun Date: Thu, 20 Sep 2012 06:26:07 +0800 Subject: [PATCH] minor fix: handle mstat err, check indexstore instead of store --- lib/node-static.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/node-static.js b/lib/node-static.js index 136311b..824d338 100644 --- a/lib/node-static.js +++ b/lib/node-static.js @@ -58,7 +58,7 @@ this.Server.prototype.serveDir = function (pathname, req, res, finish) { if (!e) { that.respond(null, 200, {}, [htmlIndex], stat, req, res, finish); } else { - if (pathname in exports.store) { + if (pathname in exports.indexStore) { streamFiles(exports.indexStore[pathname].files); } else { // Stream a directory of files as a single file. @@ -73,6 +73,7 @@ this.Server.prototype.serveDir = function (pathname, req, res, finish) { }); function streamFiles(files) { util.mstat(pathname, files, function (e, stat) { + if (e) { return finish(404, {}) } that.respond(pathname, 200, {}, files, stat, req, res, finish); }); }