about summary refs log tree commit diff
path: root/app/services
diff options
context:
space:
mode:
authorEugen Rochko <eugen@zeonfederated.com>2016-10-12 19:25:46 +0200
committerEugen Rochko <eugen@zeonfederated.com>2016-10-12 19:25:46 +0200
commitc257b29d8654964b43eafe21fb2b0e0601252ee5 (patch)
treeba207749905d8471987595224f6d4d6bd168c553 /app/services
parentf7f3e6e3bef5c69dbafa3dbd9b80ce2ec167fdd6 (diff)
Fix up a few exceptions
Diffstat (limited to 'app/services')
-rw-r--r--app/services/fetch_remote_account_service.rb2
-rw-r--r--app/services/process_feed_service.rb13
2 files changed, 11 insertions, 4 deletions
diff --git a/app/services/fetch_remote_account_service.rb b/app/services/fetch_remote_account_service.rb
index 83a81a61b..8a6b1e1b4 100644
--- a/app/services/fetch_remote_account_service.rb
+++ b/app/services/fetch_remote_account_service.rb
@@ -19,6 +19,8 @@ class FetchRemoteAccountService < BaseService
     Rails.logger.debug "Going to webfinger #{username}@#{domain}"
 
     return FollowRemoteAccountService.new.call("#{username}@#{domain}")
+  rescue TypeError => e
+    Rails.logger.debug "Unparseable URL given: #{url}"
   rescue Nokogiri::XML::XPath::SyntaxError
     Rails.logger.debug "Invalid XML or missing namespace"
   end
diff --git a/app/services/process_feed_service.rb b/app/services/process_feed_service.rb
index cd9bd8e93..1efa0e15a 100644
--- a/app/services/process_feed_service.rb
+++ b/app/services/process_feed_service.rb
@@ -100,9 +100,14 @@ class ProcessFeedService < BaseService
 
       next unless media.nil?
 
-      media = MediaAttachment.new(account: status.account, status: status, remote_url: enclosure_link.attribute('href').value)
-      media.file_remote_url = enclosure_link.attribute('href').value
-      media.save
+      begin
+        media = MediaAttachment.new(account: status.account, status: status, remote_url: enclosure_link.attribute('href').value)
+        media.file_remote_url = enclosure_link.attribute('href').value
+        media.save
+      rescue Paperclip::Errors::NotIdentifiedByImageMagickError
+        Rails.logger.debug "Error saving attachment from #{enclosure_link.attribute('href').value}"
+        next
+      end
     end
   end
 
@@ -213,7 +218,7 @@ class ProcessFeedService < BaseService
   end
 
   def target_url(xml)
-    xml.at_xpath('.//activity:object').at_xpath('./xmlns:link[@rel="alternate"]', activity: ACTIVITY_NS).attribute('href').value
+    xml.at_xpath('.//activity:object', activity: ACTIVITY_NS).at_xpath('./xmlns:link[@rel="alternate"]').attribute('href').value
   end
 
   def object_type(xml)