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:
Krzysztof Kotlarek
2021-07-26 12:35:27 +10:00
committed by GitHub
parent 6db93e86d4
commit 88aa0136e3
2 changed files with 6 additions and 1 deletions

View File

@ -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