aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorHaelwenn <contact+git.pleroma.social@hacktivis.me>2019-07-23 18:39:01 +0000
committerHaelwenn <contact+git.pleroma.social@hacktivis.me>2019-07-23 18:39:01 +0000
commit638f772356afdb92a722ae54059604dbbab94d58 (patch)
tree2615bdb374a4df01794cb0378e6f9a4b1e232a58 /lib
parenta042a7ac6d65dca3e19e6c4ddd65d2010e94aeba (diff)
parente7c64f106eb578f802d000ecd8dacbc00a357b66 (diff)
downloadpleroma-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.ex15
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