summaryrefslogtreecommitdiff
path: root/app/controllers
diff options
context:
space:
mode:
authorJacob Vosmaer <contact@jacobvosmaer.nl>2016-03-03 17:59:47 +0100
committerJacob Vosmaer <contact@jacobvosmaer.nl>2016-03-03 17:59:47 +0100
commitfc90d9e5896cdcccedb697fd4536f126d10f3f8e (patch)
treef6b26659982f737e0e8bbc28929bde43325b48de /app/controllers
parent00cb4a97147a8f760d37c5f6fae11f93ba4ede34 (diff)
downloadgitlab-ce-fc90d9e5896cdcccedb697fd4536f126d10f3f8e.tar.gz
Tell clients/proxies to cache raw blob requests
Diffstat (limited to 'app/controllers')
-rw-r--r--app/controllers/projects/avatars_controller.rb2
-rw-r--r--app/controllers/projects/raw_controller.rb2
2 files changed, 4 insertions, 0 deletions
diff --git a/app/controllers/projects/avatars_controller.rb b/app/controllers/projects/avatars_controller.rb
index b64dbbd89ce..6de7888888f 100644
--- a/app/controllers/projects/avatars_controller.rb
+++ b/app/controllers/projects/avatars_controller.rb
@@ -7,6 +7,8 @@ class Projects::AvatarsController < Projects::ApplicationController
@blob = @repository.blob_at_branch('master', @project.avatar_in_git)
if @blob
headers['X-Content-Type-Options'] = 'nosniff'
+ set_cache_headers
+ check_etag!
headers.store(*Gitlab::Workhorse.send_git_blob(@repository, @blob))
headers['Content-Disposition'] = 'inline'
headers['Content-Type'] = safe_content_type(@blob)
diff --git a/app/controllers/projects/raw_controller.rb b/app/controllers/projects/raw_controller.rb
index d9723acb1d9..b6ff08262d7 100644
--- a/app/controllers/projects/raw_controller.rb
+++ b/app/controllers/projects/raw_controller.rb
@@ -12,6 +12,8 @@ class Projects::RawController < Projects::ApplicationController
if @blob
headers['X-Content-Type-Options'] = 'nosniff'
+ check_etag!
+ set_cache_headers
if @blob.lfs_pointer?
send_lfs_object