FIX: Invalid logo in discobot's certificate when SiteSetting.logo_small_url is blank.

https://meta.discourse.org/t/broken-image-in-discobot-certificate-with-no-logo-small-url/76594/2
This commit is contained in:
Guo Xiang Tan 2017-12-22 09:30:24 +08:00
parent ee1b90503c
commit 32171ad286
2 changed files with 15 additions and 0 deletions

View File

@ -568,6 +568,8 @@ module DiscourseNarrativeBot
end
def logo_group(size, width, height)
return unless SiteSetting.logo_small_url.present?
begin
uri = URI(SiteSetting.logo_small_url)

View File

@ -8,4 +8,17 @@ RSpec.describe DiscourseNarrativeBot::CertificateGenerator do
expect { described_class.new(user, "2017-00-10") }.to_not raise_error
end
end
describe '#logo_group' do
describe 'when SiteSetting.logo_small_url is blank' do
before do
SiteSetting.logo_small_url = ''
end
it 'should not try to fetch a image' do
expect(described_class.new(user, "2017-02-10").send(:logo_group, 1, 1, 1))
.to eq(nil)
end
end
end
end