Skip to content

Commit

Permalink
minor fix: handle mstat err, check indexstore instead of store
Browse files Browse the repository at this point in the history
  • Loading branch information
zhangyijun committed Sep 19, 2012
1 parent cba7250 commit 18684bc
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/node-static.js
Expand Up @@ -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.
Expand All @@ -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);
});
}
Expand Down

0 comments on commit 18684bc

Please sign in to comment.