summaryrefslogtreecommitdiff
path: root/app/helpers/blob_helper.rb
diff options
context:
space:
mode:
authorFilipa Lacerda <filipa@gitlab.com>2017-02-27 12:30:26 +0000
committerFilipa Lacerda <filipa@gitlab.com>2017-02-27 12:30:26 +0000
commit729d2ea04d24c068519515a4df6d4c38f25cd229 (patch)
tree57048bfd961acd44b0f278daf215b6e141fbd021 /app/helpers/blob_helper.rb
parentf95d46c9d22603445fc7b8247df1120eaed67cd1 (diff)
parentc425f366bfa84efab92b5d5e1d0721f16a2890bc (diff)
downloadgitlab-ce-ci-tables-ui-improvements.tar.gz
Merge branch 'master' into ci-tables-ui-improvementsci-tables-ui-improvements
* master: (196 commits) Add quotes to coverage pattern Update CHANGELOG.md Bump omniauth to 1.4.2 Bump Hashie to 3.5.5 to eliminate warning noise use single backticks for inline code Add performance query regression fix for !9088 affecting #27267 Fix spec API: Return 400 for all validation erros in the mebers API Adds confirmation for cancel button Add newline Corrected indentation on the template string Adds backoff algo from EE to CE We don't need these checks anymore Raise error when no content is provided Address review Update API v3 in line with v4 Fix new offenses Fix spec Fix specs Rename commit_file, commit_dir and remove_file and update specs ...
Diffstat (limited to 'app/helpers/blob_helper.rb')
-rw-r--r--app/helpers/blob_helper.rb21
1 files changed, 11 insertions, 10 deletions
diff --git a/app/helpers/blob_helper.rb b/app/helpers/blob_helper.rb
index 311a70725ab..7f32c1b5300 100644
--- a/app/helpers/blob_helper.rb
+++ b/app/helpers/blob_helper.rb
@@ -153,16 +153,17 @@ module BlobHelper
# Because we are opionated we set the cache headers ourselves.
response.cache_control[:public] = @project.public?
- if @ref && @commit && @ref == @commit.id
- # This is a link to a commit by its commit SHA. That means that the blob
- # is immutable. The only reason to invalidate the cache is if the commit
- # was deleted or if the user lost access to the repository.
- response.cache_control[:max_age] = Blob::CACHE_TIME_IMMUTABLE
- else
- # A branch or tag points at this blob. That means that the expected blob
- # value may change over time.
- response.cache_control[:max_age] = Blob::CACHE_TIME
- end
+ response.cache_control[:max_age] =
+ if @ref && @commit && @ref == @commit.id
+ # This is a link to a commit by its commit SHA. That means that the blob
+ # is immutable. The only reason to invalidate the cache is if the commit
+ # was deleted or if the user lost access to the repository.
+ Blob::CACHE_TIME_IMMUTABLE
+ else
+ # A branch or tag points at this blob. That means that the expected blob
+ # value may change over time.
+ Blob::CACHE_TIME
+ end
response.etag = @blob.id
!stale