summaryrefslogtreecommitdiff
path: root/app/controllers/concerns/uploads_actions.rb
diff options
context:
space:
mode:
authorTim Zallmann <tzallmann@gitlab.com>2019-01-21 22:25:54 +0100
committerTim Zallmann <tzallmann@gitlab.com>2019-01-21 22:25:54 +0100
commit5fc63a1d232608530a4cd4a45c34a2bed695169a (patch)
tree7d1d6c680aa048429a1472955798681110df0976 /app/controllers/concerns/uploads_actions.rb
parentc141d0afb15366beb1cae8a240faf6aaeb632214 (diff)
downloadgitlab-ce-5fc63a1d232608530a4cd4a45c34a2bed695169a.tar.gz
Changed the Caching of User Avatars to be public and to 5 minutes
Diffstat (limited to 'app/controllers/concerns/uploads_actions.rb')
-rw-r--r--app/controllers/concerns/uploads_actions.rb12
1 files changed, 11 insertions, 1 deletions
diff --git a/app/controllers/concerns/uploads_actions.rb b/app/controllers/concerns/uploads_actions.rb
index c114e16edf8..7106c61e749 100644
--- a/app/controllers/concerns/uploads_actions.rb
+++ b/app/controllers/concerns/uploads_actions.rb
@@ -29,7 +29,13 @@ module UploadsActions
def show
return render_404 unless uploader&.exists?
- expires_in 0.seconds, must_revalidate: true, private: true
+ if cache_privately?
+ expires_in 0.seconds, must_revalidate: true, private: true
+ else
+ # We need to reset caching from the applications controller to get rid of the no-store value
+ headers['Cache-Control'] = ''
+ expires_in 5.minutes, public: true, must_revalidate: false
+ end
disposition = uploader.image_or_video? ? 'inline' : 'attachment'
@@ -114,6 +120,10 @@ module UploadsActions
nil
end
+ def cache_privately?
+ true
+ end
+
def model
strong_memoize(:model) { find_model }
end