[Pkg-javascript-commits] [node-static] 79/151: minor fix: handle mstat err, check indexstore instead of store
Tonnerre Lombard
tonnerre-guest at moszumanska.debian.org
Tue Jan 7 23:18:00 UTC 2014
This is an automated email from the git hooks/post-receive script.
tonnerre-guest pushed a commit to branch master
in repository node-static.
commit 18684bccb4257f7194830054393129a39458c2dc
Author: zhangyijun <joa.zhang at gmail.com>
Date: Thu Sep 20 06:26:07 2012 +0800
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);
});
}
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/node-static.git
More information about the Pkg-javascript-commits
mailing list