Procházet zdrojové kódy

Fix up a few exceptions

master
Eugen Rochko před 7 roky
rodič
revize
c257b29d86
2 změnil soubory, kde provedl 11 přidání a 4 odebrání
  1. +2
    -0
      app/services/fetch_remote_account_service.rb
  2. +9
    -4
      app/services/process_feed_service.rb

+ 2
- 0
app/services/fetch_remote_account_service.rb Zobrazit soubor

@@ -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


+ 9
- 4
app/services/process_feed_service.rb Zobrazit soubor

@@ -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)


Načítá se…
Zrušit
Uložit