summaryrefslogtreecommitdiff
path: root/lib/gitlab/favicon.rb
diff options
context:
space:
mode:
authorAlexis Reigel <mail@koffeinfrei.org>2017-09-27 13:23:05 +0200
committerAlexis Reigel <mail@koffeinfrei.org>2018-06-05 16:20:20 +0200
commit822023c64ccab23cfdacb42e191dcec4f812adfd (patch)
tree004e9571a26a6f624147d67dfd7489a632780ad4 /lib/gitlab/favicon.rb
parentbf27c6841c1cb6b68f67d33d6eb2de63ad8b390f (diff)
downloadgitlab-ce-822023c64ccab23cfdacb42e191dcec4f812adfd.tar.gz
Add a '?' to the custom favicon's urls
Without the '?' at the end of the favicon url the custom favicon (i.e. the favicons that are served through `UploadController`) are not shown in the browser. It may have something to do with how `#send_file` / `#send_data` set http headers. When serving the same icon file from the public directory everything is fine.
Diffstat (limited to 'lib/gitlab/favicon.rb')
-rw-r--r--lib/gitlab/favicon.rb11
1 files changed, 9 insertions, 2 deletions
diff --git a/lib/gitlab/favicon.rb b/lib/gitlab/favicon.rb
index 17e737ac913..e7fe0bff5b8 100644
--- a/lib/gitlab/favicon.rb
+++ b/lib/gitlab/favicon.rb
@@ -2,7 +2,7 @@ module Gitlab
class Favicon
class << self
def default
- return appearance_favicon.default.url if appearance_favicon.exists?
+ return custom_favicon_url(appearance_favicon.default.url) if appearance_favicon.exists?
return 'favicon-yellow.ico' if Gitlab::Utils.to_boolean(ENV['CANARY'])
return 'favicon-blue.ico' if Rails.env.development?
@@ -11,7 +11,7 @@ module Gitlab
def status(status_name)
if appearance_favicon.exists?
- appearance_favicon.public_send("status_#{status_name}").url
+ custom_favicon_url(appearance_favicon.public_send("status_#{status_name}").url) # rubocop:disable GitlabSecurity/PublicSend
else
dir = 'ci_favicons'
dir = File.join(dir, 'dev') if Rails.env.development?
@@ -30,6 +30,13 @@ module Gitlab
def appearance_favicon
appearance.favicon
end
+
+ # Without the '?' at the end of the favicon url the custom favicon (i.e.
+ # the favicons that are served through `UploadController`) are not shown
+ # in the browser.
+ def custom_favicon_url(url)
+ "#{url}?"
+ end
end
end
end