From e573bb0990ece4b1a521ccf8a4c7bec5972d3538 Mon Sep 17 00:00:00 2001 From: ThibG Date: Fri, 30 Mar 2018 15:44:54 +0200 Subject: Fix compatibility with PeerTube (#6968) * Support fetching objects of convertible types by URL (fixes #6924) * Ignore invalid hashtags --- app/services/fetch_atom_service.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'app/services/fetch_atom_service.rb') diff --git a/app/services/fetch_atom_service.rb b/app/services/fetch_atom_service.rb index 62dea8298..87076cc07 100644 --- a/app/services/fetch_atom_service.rb +++ b/app/services/fetch_atom_service.rb @@ -44,7 +44,7 @@ class FetchAtomService < BaseService json = body_to_json(body) if supported_context?(json) && json['type'] == 'Person' && json['inbox'].present? [json['id'], { prefetched_body: body, id: true }, :activitypub] - elsif supported_context?(json) && json['type'] == 'Note' + elsif supported_context?(json) && expected_type?(json) [json['id'], { prefetched_body: body, id: true }, :activitypub] else @unsupported_activity = true @@ -61,6 +61,10 @@ class FetchAtomService < BaseService end end + def expected_type?(json) + (ActivityPub::Activity::Create::SUPPORTED_TYPES + ActivityPub::Activity::Create::CONVERTED_TYPES).include? json['type'] + end + def process_html(response) page = Nokogiri::HTML(response.body_with_limit) -- cgit