Read asset host from ActionController::Base instead of application config
This commit is contained in:
parent
ee2a9e0af0
commit
f83f1db4bd
3 changed files with 9 additions and 2 deletions
6
changelogs/unreleased/dm-favicon-asset-host.yml
Normal file
6
changelogs/unreleased/dm-favicon-asset-host.yml
Normal file
|
@ -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
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue