]> cat aescling's git repositories - mastodon.git/commitdiff
Handle Mastodon::HostValidationError when pulling remoteable assets (#6782)
authorDaniel Hunsaker <danhunsaker@gmail.com>
Sat, 17 Mar 2018 12:27:50 +0000 (06:27 -0600)
committerEugen Rochko <eugen@zeonfederated.com>
Sat, 17 Mar 2018 12:27:50 +0000 (13:27 +0100)
This will prevent, for example, `rake mastodon:redownload_avatars` from crashing when an instance is no longer responding to connection attempts, instead silently continuing as expected.

app/models/concerns/remotable.rb

index 020303a2f97ade3dd9556d60d448c8b4a0533345..69685ec83af455a602b64ac32ba62aa4ed122d97 100644 (file)
@@ -38,7 +38,7 @@ module Remotable
           send("#{attachment_name}_file_name=", basename + extname)
 
           self[attribute_name] = url if has_attribute?(attribute_name)
-        rescue HTTP::TimeoutError, HTTP::ConnectionError, OpenSSL::SSL::SSLError, Paperclip::Errors::NotIdentifiedByImageMagickError, Addressable::URI::InvalidURIError => e
+        rescue HTTP::TimeoutError, HTTP::ConnectionError, OpenSSL::SSL::SSLError, Paperclip::Errors::NotIdentifiedByImageMagickError, Addressable::URI::InvalidURIError, Mastodon::HostValidationError => e
           Rails.logger.debug "Error fetching remote #{attachment_name}: #{e}"
           nil
         end