Browse Source

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?
master
unarist 7 years ago
committed by Eugen Rochko
parent
commit
5927b43c0f
2 changed files with 2 additions and 2 deletions
  1. +1
    -1
      app/helpers/jsonld_helper.rb
  2. +1
    -1
      app/services/fetch_atom_service.rb

+ 1
- 1
app/helpers/jsonld_helper.rb View File

@ -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)

+ 1
- 1
app/services/fetch_atom_service.rb View File

@ -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

Loading…
Cancel
Save