Fixes 404 when request header Accept-Encoding not set #48

Open
wants to merge 2 commits into
from
View
@@ -209,14 +209,16 @@ exports = module.exports = function staticGzip(dirPath, options){
}
}
- if (!method) return pass(filename);
fs.stat(filename, function(err, stat) {
if (err) {
return next();
}
+ // Check if file exists before passing uncompressed to client
+ if (!method) return pass(filename);
+
if (stat.isDirectory()) {
return next();
}