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?
这个提交包含在:
unarist
2017-08-23 03:00:49 +09:00
提交者 Eugen Rochko
父节点 871c0d251a
当前提交 5927b43c0f
共有 2 个文件被更改,包括 2 次插入2 次删除

查看文件

@ -14,7 +14,7 @@ module JsonLdHelper
end
def supported_context?(json)
equals_or_includes?(json['@context'], ActivityPub::TagManager::CONTEXT)
!json.nil? && equals_or_includes?(json['@context'], ActivityPub::TagManager::CONTEXT)
end
def fetch_resource(uri)

查看文件

@ -82,7 +82,7 @@ class FetchAtomService < BaseService
def supported_activity?(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
end
end