diff options
author | Haelwenn <contact+git.pleroma.social@hacktivis.me> | 2019-07-23 18:39:01 +0000 |
---|---|---|
committer | Haelwenn <contact+git.pleroma.social@hacktivis.me> | 2019-07-23 18:39:01 +0000 |
commit | 638f772356afdb92a722ae54059604dbbab94d58 (patch) | |
tree | 2615bdb374a4df01794cb0378e6f9a4b1e232a58 /lib | |
parent | a042a7ac6d65dca3e19e6c4ddd65d2010e94aeba (diff) | |
parent | e7c64f106eb578f802d000ecd8dacbc00a357b66 (diff) | |
download | pleroma-638f772356afdb92a722ae54059604dbbab94d58.tar.gz |
Merge branch 'bugfix/http-signatures-misskey' into 'develop'
signature: properly deduce the actor from misskey key IDs
See merge request pleroma/pleroma!1476
Diffstat (limited to 'lib')
-rw-r--r-- | lib/pleroma/signature.ex | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/lib/pleroma/signature.ex b/lib/pleroma/signature.ex index 2a0823ecf..0bf49fd7c 100644 --- a/lib/pleroma/signature.ex +++ b/lib/pleroma/signature.ex @@ -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 |