From 57d0a2e803d8efd2721c575e225bc9d90910d6d3 Mon Sep 17 00:00:00 2001 From: Chad Weider Date: Sun, 4 Mar 2012 15:04:54 -0800 Subject: [PATCH] Avoid orphaned cache files from breaking the caching layer. --- node/utils/caching_middleware.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/node/utils/caching_middleware.js b/node/utils/caching_middleware.js index f25059b882f..d99023e09d5 100644 --- a/node/utils/caching_middleware.js +++ b/node/utils/caching_middleware.js @@ -54,7 +54,7 @@ CachingMiddleware.prototype = new function () { var modifiedSince = (req.headers['if-modified-since'] && new Date(req.headers['if-modified-since'])); var lastModifiedCache = !error && stats.mtime; - if (lastModifiedCache) { + if (lastModifiedCache && responseCache[cacheKey]) { req.headers['if-modified-since'] = lastModifiedCache.toUTCString(); } else { delete req.headers['if-modified-since'];