signature: properly deduce the actor from misskey key IDs

This commit is contained in:
Ariadne Conill 2019-07-23 16:47:22 +00:00
commit e7c64f106e
2 changed files with 27 additions and 9 deletions

View file

@ -10,9 +10,18 @@ defmodule Pleroma.Signature do
alias Pleroma.Web.ActivityPub.ActivityPub
def key_id_to_actor_id(key_id) do
URI.parse(key_id)
|> Map.put(:fragment, nil)
|> URI.to_string()
uri =
URI.parse(key_id)
|> Map.put(:fragment, nil)
uri =
if String.ends_with?(uri.path, "/publickey") do
Map.put(uri, :path, String.replace(uri.path, "/publickey", ""))
else
uri
end
URI.to_string(uri)
end
def fetch_public_key(conn) do