diff options
author | Douwe Maan <douwe@selenight.nl> | 2018-06-29 12:21:51 +0300 |
---|---|---|
committer | Douwe Maan <douwe@selenight.nl> | 2018-06-29 12:22:51 +0300 |
commit | f83f1db4bde285ff8539e798a5b15383b06caff6 (patch) | |
tree | 556db4f6fa055f00d9038c50f77e39ec62d82a21 | |
parent | ee2a9e0af0c91e4cc0d1c24acf35ff1eba1cc8db (diff) |
Read asset host from ActionController::Base instead of application config
-rw-r--r-- | changelogs/unreleased/dm-favicon-asset-host.yml | 6 | ||||
-rw-r--r-- | lib/gitlab/favicon.rb | 3 | ||||
-rw-r--r-- | spec/lib/gitlab/favicon_spec.rb | 2 |
3 files changed, 9 insertions, 2 deletions
diff --git a/changelogs/unreleased/dm-favicon-asset-host.yml b/changelogs/unreleased/dm-favicon-asset-host.yml new file mode 100644 index 00000000000..c2dc9d765e5 --- /dev/null +++ b/changelogs/unreleased/dm-favicon-asset-host.yml @@ -0,0 +1,6 @@ +--- +title: Always serve favicon from main GitLab domain so that CI badge can be drawn + over it +merge_request: +author: +type: fixed diff --git a/lib/gitlab/favicon.rb b/lib/gitlab/favicon.rb index d512fc58e46..4850a6c0430 100644 --- a/lib/gitlab/favicon.rb +++ b/lib/gitlab/favicon.rb @@ -38,7 +38,8 @@ module Gitlab # we only want to create full urls when there's a different asset_host # configured. def host - if Gitlab::Application.config.asset_host.nil? || Gitlab::Application.config.asset_host == Gitlab.config.gitlab.base_url + asset_host = ActionController::Base.asset_host + if asset_host.nil? || asset_host == Gitlab.config.gitlab.base_url nil else Gitlab.config.gitlab.base_url diff --git a/spec/lib/gitlab/favicon_spec.rb b/spec/lib/gitlab/favicon_spec.rb index 122dcd9634c..68abcb3520a 100644 --- a/spec/lib/gitlab/favicon_spec.rb +++ b/spec/lib/gitlab/favicon_spec.rb @@ -32,7 +32,7 @@ RSpec.describe Gitlab::Favicon, :request_store do end it 'returns a full url when the asset host is configured' do - allow(Gitlab::Application.config).to receive(:asset_host).and_return('http://assets.local') + allow(ActionController::Base).to receive(:asset_host).and_return('http://assets.local') expect(described_class.main).to match %r{^http://localhost/assets/favicon-(?:\h+).png$} end end |