Select correct self link when parsing Webfinger response (#31110)
This commit is contained in:
		@@ -49,7 +49,7 @@ class ActivityPub::FetchRemoteActorService < BaseService
 | 
			
		||||
    confirmed_username, confirmed_domain = split_acct(webfinger.subject)
 | 
			
		||||
 | 
			
		||||
    if @username.casecmp(confirmed_username).zero? && @domain.casecmp(confirmed_domain).zero?
 | 
			
		||||
      raise Error, "Webfinger response for #{@username}@#{@domain} does not loop back to #{@uri}" if webfinger.link('self', 'href') != @uri
 | 
			
		||||
      raise Error, "Webfinger response for #{@username}@#{@domain} does not loop back to #{@uri}" if webfinger.self_link_href != @uri
 | 
			
		||||
 | 
			
		||||
      return
 | 
			
		||||
    end
 | 
			
		||||
@@ -58,8 +58,7 @@ class ActivityPub::FetchRemoteActorService < BaseService
 | 
			
		||||
    @username, @domain                   = split_acct(webfinger.subject)
 | 
			
		||||
 | 
			
		||||
    raise Webfinger::RedirectError, "Too many webfinger redirects for URI #{@uri} (stopped at #{@username}@#{@domain})" unless confirmed_username.casecmp(@username).zero? && confirmed_domain.casecmp(@domain).zero?
 | 
			
		||||
 | 
			
		||||
    raise Error, "Webfinger response for #{@username}@#{@domain} does not loop back to #{@uri}" if webfinger.link('self', 'href') != @uri
 | 
			
		||||
    raise Error, "Webfinger response for #{@username}@#{@domain} does not loop back to #{@uri}" if webfinger.self_link_href != @uri
 | 
			
		||||
  rescue Webfinger::RedirectError => e
 | 
			
		||||
    raise Error, e.message
 | 
			
		||||
  rescue Webfinger::Error => e
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user