aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMark Longair <mhl@pobox.com>2013-05-24 14:42:43 +0100
committerMark Longair <mhl@pobox.com>2013-05-24 18:50:58 +0100
commit011e55bd4acf4f3c9de91c5ed4c646e855f19c24 (patch)
treeade82e663b566817644359c82424e4058c2a0ea6
parentf8cc81a7791c6055dc6cf829e25138b7f6261a3e (diff)
Only cache attachments that are returned with a 200 HTTP status code
Otherwise redirects will be cached, and since headers and the status code aren't stored, a non-redirecting redirect page will be returned in the future, but with 200. It's easiest to only cache the 200 responses.
-rw-r--r--app/controllers/request_controller.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/app/controllers/request_controller.rb b/app/controllers/request_controller.rb
index 96f62319e..b8ccdf926 100644
--- a/app/controllers/request_controller.rb
+++ b/app/controllers/request_controller.rb
@@ -721,7 +721,7 @@ class RequestController < ApplicationController
yield
- if params[:skip_cache].nil?
+ if params[:skip_cache].nil? && response.status == 200
# write it to the fileystem ourselves, so is just a plain file. (The
# various fragment cache functions using Ruby Marshall to write the file
# which adds a header, so isnt compatible with images that have been