Check error not stats.

This commit is contained in:
Chad Weider 2012-02-28 18:05:27 -08:00
parent af4bd5ca65
commit 96ee77d85b
1 changed files with 1 additions and 1 deletions

View File

@ -53,7 +53,7 @@ CachingMiddleware.prototype = new function () {
fs.stat(CACHE_DIR + 'minified_' + cacheKey, function (error, stats) { fs.stat(CACHE_DIR + 'minified_' + cacheKey, function (error, stats) {
var modifiedSince = (req.headers['if-modified-since'] var modifiedSince = (req.headers['if-modified-since']
&& new Date(req.headers['if-modified-since'])); && new Date(req.headers['if-modified-since']));
var lastModifiedCache = stats && stats.mtime; var lastModifiedCache = !error && stats.mtime;
if (lastModifiedCache) { if (lastModifiedCache) {
req.headers['if-modified-since'] = lastModifiedCache.toUTCString(); req.headers['if-modified-since'] = lastModifiedCache.toUTCString();
} else { } else {