mirror of
https://git.kescher.at/CatCatNya/catstodon.git
synced 2024-11-30 09:49:03 +01:00
Fix FetchAtomService not finding alternatives if there's a Link header (#6170)
without them, such as is the case with GNU social Fixes the ability to find GNU social accounts via URL in search and when using remote follow function
This commit is contained in:
parent
256c2b1de0
commit
7d4f4f9aab
1 changed files with 5 additions and 3 deletions
|
@ -50,7 +50,7 @@ class FetchAtomService < BaseService
|
||||||
@unsupported_activity = true
|
@unsupported_activity = true
|
||||||
nil
|
nil
|
||||||
end
|
end
|
||||||
elsif @response['Link'] && !terminal
|
elsif @response['Link'] && !terminal && link_header.find_link(%w(rel alternate))
|
||||||
process_headers
|
process_headers
|
||||||
elsif @response.mime_type == 'text/html' && !terminal
|
elsif @response.mime_type == 'text/html' && !terminal
|
||||||
process_html
|
process_html
|
||||||
|
@ -70,8 +70,6 @@ class FetchAtomService < BaseService
|
||||||
end
|
end
|
||||||
|
|
||||||
def process_headers
|
def process_headers
|
||||||
link_header = LinkHeader.parse(@response['Link'].is_a?(Array) ? @response['Link'].first : @response['Link'])
|
|
||||||
|
|
||||||
json_link = link_header.find_link(%w(rel alternate), %w(type application/activity+json)) || link_header.find_link(%w(rel alternate), ['type', 'application/ld+json; profile="https://www.w3.org/ns/activitystreams"'])
|
json_link = link_header.find_link(%w(rel alternate), %w(type application/activity+json)) || link_header.find_link(%w(rel alternate), ['type', 'application/ld+json; profile="https://www.w3.org/ns/activitystreams"'])
|
||||||
atom_link = link_header.find_link(%w(rel alternate), %w(type application/atom+xml))
|
atom_link = link_header.find_link(%w(rel alternate), %w(type application/atom+xml))
|
||||||
|
|
||||||
|
@ -80,4 +78,8 @@ class FetchAtomService < BaseService
|
||||||
|
|
||||||
result
|
result
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def link_header
|
||||||
|
@link_header ||= LinkHeader.parse(@response['Link'].is_a?(Array) ? @response['Link'].first : @response['Link'])
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue