mirror of
https://github.com/discourse/discourse.git
synced 2024-11-25 09:42:07 +08:00
FIX: ignore SVGs when regenerating missing optimized images.
When running `rake uploads:regenerate_missing_optimized`, a `Discourse::InvalidAccess` will be raised if an SVG file is being processed as `OptimizedImage.prepend_decoder!` doesn't support the svg extension. This commit simply copies the original SVG file as the thumbnail, just like currently `OptimizedImage.create_for` does.
This commit is contained in:
parent
6b36b31ee0
commit
ba357dd6cc
|
@ -353,7 +353,16 @@ def regenerate_missing_optimized
|
|||
|
||||
if File.exist?(original) && File.size(original) > 0
|
||||
FileUtils.mkdir_p(File.dirname(thumbnail))
|
||||
OptimizedImage.resize(original, thumbnail, optimized_image.width, optimized_image.height)
|
||||
if upload.extension == "svg"
|
||||
FileUtils.cp(original, thumbnail)
|
||||
else
|
||||
OptimizedImage.resize(
|
||||
original,
|
||||
thumbnail,
|
||||
optimized_image.width,
|
||||
optimized_image.height,
|
||||
)
|
||||
end
|
||||
putc "#"
|
||||
else
|
||||
missing_uploads << original
|
||||
|
|
Loading…
Reference in New Issue
Block a user