Don't create attachments if remote file cannot be fetched

pull/152/head
Eugen Rochko 2016-11-18 23:16:34 +01:00
parent 882de42bab
commit e4f56fa942
2 changed files with 1 additions and 3 deletions

View File

@ -22,8 +22,6 @@ class MediaAttachment < ApplicationRecord
def file_remote_url=(url) def file_remote_url=(url)
self.file = URI.parse(url) self.file = URI.parse(url)
rescue OpenURI::HTTPError => e
Rails.logger.debug "Error fetching remote attachment: #{e}"
end end
def image? def image?

View File

@ -173,7 +173,7 @@ class ProcessFeedService < BaseService
begin begin
media.file_remote_url = link['href'] media.file_remote_url = link['href']
media.save media.save
rescue Paperclip::Errors::NotIdentifiedByImageMagickError rescue OpenURI::HTTPError, Paperclip::Errors::NotIdentifiedByImageMagickError
next next
end end
end end