Support public key URIs that incomprehensibly have GET args
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful

Fixes #528
This commit is contained in:
FloatingGhost 2023-04-25 13:30:20 +01:00
parent d6bed599c8
commit b86b3a9e29
3 changed files with 11 additions and 0 deletions

View file

@ -4,6 +4,11 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
## Unreleased
## Fixed
- Support for `streams` public key URIs
## 2023.04
## Added

View file

@ -17,6 +17,7 @@ def key_id_to_actor_id(key_id) do
key_id
|> URI.parse()
|> Map.put(:fragment, nil)
|> Map.put(:query, nil)
|> remove_suffix(@known_suffixes)
maybe_ap_id = URI.to_string(uri)

View file

@ -114,6 +114,11 @@ test "it deduces the actor id for gotoSocial" do
{:ok, "https://example.com/users/1234"}
end
test "it deduces the actor ID for streams" do
assert Signature.key_id_to_actor_id("https://example.com/users/1234?operation=getkey") ==
{:ok, "https://example.com/users/1234"}
end
test "it calls webfinger for 'acct:' accounts" do
with_mock(Pleroma.Web.WebFinger,
finger: fn _ -> {:ok, %{"ap_id" => "https://gensokyo.2hu/users/raymoo"}} end