Fix exception when autotagging animated_gifs.
Fixes this exception caused by the animated_gif autotagger trying to access the
image file, which fails if the image is not hosted on the webserver.
Magick::ImageMagickError exception raised
unable to open image `/var/www/danbooru2/releases/20170322212609/public/data/f0e32c0e2d906c4932858866346f98b5.gif': No such file or directory @ error/blob.c/OpenBlob/2712
app/models/post.rb:177:in `ping'
app/models/post.rb:177:in `is_animated_gif?'
app/models/post.rb:684:in `add_automatic_tags'
app/models/post.rb:638:in `normalize_tags'
app/controllers/posts_controller.rb:49:in `update'
This commit is contained in:
@@ -173,7 +173,7 @@ class Post < ActiveRecord::Base
|
||||
end
|
||||
|
||||
def is_animated_gif?
|
||||
if file_ext =~ /gif/i
|
||||
if file_ext =~ /gif/i && File.exists?(file_path)
|
||||
return Magick::Image.ping(file_path).length > 1
|
||||
else
|
||||
return false
|
||||
|
||||
Reference in New Issue
Block a user