diff options
-rw-r--r-- | app/services/fetch_remote_account_service.rb | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/app/services/fetch_remote_account_service.rb b/app/services/fetch_remote_account_service.rb index 6a6a696d6..50ffc47c6 100644 --- a/app/services/fetch_remote_account_service.rb +++ b/app/services/fetch_remote_account_service.rb @@ -19,11 +19,16 @@ class FetchRemoteAccountService < BaseService xml = Nokogiri::XML(body) xml.encoding = 'utf-8' - url_parts = Addressable::URI.parse(url) - username = xml.at_xpath('//xmlns:author/xmlns:name').try(:content) - domain = url_parts.host + email = xml.at_xpath('//xmlns:author/xmlns:email').try(:content) + if email.nil? + url_parts = Addressable::URI.parse(url) + username = xml.at_xpath('//xmlns:author/xmlns:name').try(:content) + domain = url_parts.host + else + username, domain = email.split('@') + end - return nil if username.nil? + return nil if username.nil? || domain.nil? Rails.logger.debug "Going to webfinger #{username}@#{domain}" |