mirror of
https://framagit.org/tykayn/mastodon.git
synced 2023-08-25 08:33:12 +02:00
Ignore empty response in ActivityPub::FetchRemoteStatusService (#4661)
* Ignore empty response in ActivityPub::FetchRemoteStatusService This fixes `NoMethodError: undefined method `[]' for nil:NilClass` error. * Check json.nil? in JsonLdHelper#supported_context?
This commit is contained in:
parent
871c0d251a
commit
5927b43c0f
@ -14,7 +14,7 @@ module JsonLdHelper
|
|||||||
end
|
end
|
||||||
|
|
||||||
def supported_context?(json)
|
def supported_context?(json)
|
||||||
equals_or_includes?(json['@context'], ActivityPub::TagManager::CONTEXT)
|
!json.nil? && equals_or_includes?(json['@context'], ActivityPub::TagManager::CONTEXT)
|
||||||
end
|
end
|
||||||
|
|
||||||
def fetch_resource(uri)
|
def fetch_resource(uri)
|
||||||
|
@ -82,7 +82,7 @@ class FetchAtomService < BaseService
|
|||||||
|
|
||||||
def supported_activity?(body)
|
def supported_activity?(body)
|
||||||
json = body_to_json(body)
|
json = body_to_json(body)
|
||||||
return false if json.nil? || !supported_context?(json)
|
return false unless supported_context?(json)
|
||||||
json['type'] == 'Person' ? json['inbox'].present? : true
|
json['type'] == 'Person' ? json['inbox'].present? : true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user