Fix the build.
This commit is contained in:
parent
c5e7c60a37
commit
f8b367cc9c
|
@ -244,15 +244,15 @@ class OptimizedImage < ActiveRecord::Base
|
||||||
method_name += "_animated"
|
method_name += "_animated"
|
||||||
end
|
end
|
||||||
instructions = self.send(method_name.to_sym, from, to, dimensions, opts)
|
instructions = self.send(method_name.to_sym, from, to, dimensions, opts)
|
||||||
convert_with(instructions, to)
|
convert_with(instructions, to, opts)
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.convert_with(instructions, to)
|
def self.convert_with(instructions, to, opts = {})
|
||||||
Discourse::Utils.execute_command(*instructions)
|
Discourse::Utils.execute_command(*instructions)
|
||||||
FileHelper.optimize_image!(to)
|
FileHelper.optimize_image!(to)
|
||||||
true
|
true
|
||||||
rescue => e
|
rescue => e
|
||||||
if Rails.env.test?
|
if opts[:raise_on_error]
|
||||||
raise e
|
raise e
|
||||||
else
|
else
|
||||||
Rails.logger.error("Could not optimize image #{to}: #{e.message}")
|
Rails.logger.error("Could not optimize image #{to}: #{e.message}")
|
||||||
|
|
|
@ -56,7 +56,8 @@ describe OptimizedImage do
|
||||||
"#{Rails.root}/spec/fixtures/images/svg.png",
|
"#{Rails.root}/spec/fixtures/images/svg.png",
|
||||||
tmp_path,
|
tmp_path,
|
||||||
5,
|
5,
|
||||||
5
|
5,
|
||||||
|
raise_on_error: true
|
||||||
)
|
)
|
||||||
end.to raise_error(RuntimeError, /improper image header/)
|
end.to raise_error(RuntimeError, /improper image header/)
|
||||||
ensure
|
ensure
|
||||||
|
|
Loading…
Reference in New Issue