mirror of
https://github.com/discourse/discourse.git
synced 2025-02-21 03:19:10 +00:00
FIX: do not raise exception when svg path is nil (#13844)
Bug was introduced here: f7ab852e12
If path is nil, it should not raise an exception and continue logging the error.
This commit is contained in:
parent
6db93e86d4
commit
88aa0136e3
@ -180,10 +180,10 @@ class ThemeField < ActiveRecord::Base
|
||||
path = Discourse.store.path_for(upload)
|
||||
end
|
||||
|
||||
content = File.read(path)
|
||||
error = nil
|
||||
|
||||
begin
|
||||
content = File.read(path)
|
||||
svg_file = Nokogiri::XML(content) do |config|
|
||||
config.options = Nokogiri::XML::ParseOptions::NOBLANKS
|
||||
end
|
||||
|
@ -430,6 +430,11 @@ HTML
|
||||
theme_field.destroy!
|
||||
expect(SvgSprite.custom_svg_sprites(theme.id).size).to eq(0)
|
||||
end
|
||||
|
||||
it 'crashes gracefully when svg is invalid' do
|
||||
FileStore::LocalStore.any_instance.stubs(:path_for).returns(nil)
|
||||
expect(theme_field.validate_svg_sprite_xml).to match("Error with icons-sprite")
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
Loading…
x
Reference in New Issue
Block a user