]> cat aescling's git repositories - mastodon.git/commitdiff
Fix crash in FetchRemoteKeyService (#19225)
authorClaire <claire.github-309c@sitedethib.com>
Sat, 24 Sep 2022 05:41:01 +0000 (07:41 +0200)
committeraescling <aescling+gitlab@cat.family>
Thu, 17 Nov 2022 03:03:50 +0000 (22:03 -0500)
Fix regression from #19212

app/services/activitypub/fetch_remote_key_service.rb

index fe8f60b55ce2f7fd3de69723fa847231f236721e..32e82b47a58d67e0ca179ce70b6938e31eab2cdc 100644 (file)
@@ -12,7 +12,7 @@ class ActivityPub::FetchRemoteKeyService < BaseService
     if prefetched_body.nil?
       if id
         @json = fetch_resource_without_id_validation(uri)
-        if person?
+        if actor_type?
           @json = fetch_resource(@json['id'], true)
         elsif uri != @json['id']
           raise Error, "Fetched URI #{uri} has wrong id #{@json['id']}"
@@ -27,7 +27,7 @@ class ActivityPub::FetchRemoteKeyService < BaseService
     raise Error, "Unable to fetch key JSON at #{uri}" if @json.nil?
     raise Error, "Unsupported JSON-LD context for document #{uri}" unless supported_context?(@json)
     raise Error, "Unexpected object type for key #{uri}" unless expected_type?
-    return find_actor(@json['id'], @json, suppress_errors) if person?
+    return find_actor(@json['id'], @json, suppress_errors) if actor_type?
 
     @owner = fetch_resource(owner_uri, true)
 
@@ -51,10 +51,10 @@ class ActivityPub::FetchRemoteKeyService < BaseService
   end
 
   def expected_type?
-    actor? || public_key?
+    actor_type? || public_key?
   end
 
-  def actor?
+  def actor_type?
     equals_or_includes_any?(@json['type'], ActivityPub::FetchRemoteActorService::SUPPORTED_TYPES)
   end