diff --git a/app/models/user/with_avatar.rb b/app/models/user/with_avatar.rb index 5f9e0d3dc035f4cef3805b809dd6804526cc2d6e..0e28da537df9212f4eb788b67c4b8098130a9336 100644 --- a/app/models/user/with_avatar.rb +++ b/app/models/user/with_avatar.rb @@ -31,9 +31,12 @@ module User::WithAvatar end def do_update_picture - downloaded_image = open(picture_url) - content_type = downloaded_image.content_type - extension = content_type.split('/').last - self.picture.attach(io: downloaded_image, filename: "avatar.#{extension}") + begin + downloaded_image = open(picture_url) + content_type = downloaded_image.content_type + extension = content_type.split('/').last + self.picture.attach(io: downloaded_image, filename: "avatar.#{extension}") + rescue + end end end