logo

pleroma

My custom branche(s) on git.pleroma.social/pleroma/pleroma git clone https://hacktivis.me/git/pleroma.git
commit: 1b40ebfa2040da1bc80c5bbd50aff0f764d7c523
parent 87cf7010fc865f37f518d51e9b41e91cb0524bbe
Author: Mark Felder <feld@feld.me>
Date:   Fri, 26 Jan 2024 19:21:43 -0500

Pleroma.Signature: dialyzer error

lib/pleroma/signature.ex:30:pattern_match
The pattern can never match the type.

Pattern:
%{<<97, 112, 95, 105, 100>> => _ap_id}

Type:
{:error, _} | {:ok, map()}

Diffstat:

Mlib/pleroma/signature.ex2+-
Mtest/pleroma/signature_test.exs2+-
2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/pleroma/signature.ex b/lib/pleroma/signature.ex @@ -27,7 +27,7 @@ defmodule Pleroma.Signature do _ -> case Pleroma.Web.WebFinger.finger(maybe_ap_id) do - %{"ap_id" => ap_id} -> {:ok, ap_id} + {:ok, %{"ap_id" => ap_id}} -> {:ok, ap_id} _ -> {:error, maybe_ap_id} end end diff --git a/test/pleroma/signature_test.exs b/test/pleroma/signature_test.exs @@ -113,7 +113,7 @@ defmodule Pleroma.SignatureTest do test "it calls webfinger for 'acct:' accounts" do with_mock(Pleroma.Web.WebFinger, - finger: fn _ -> %{"ap_id" => "https://gensokyo.2hu/users/raymoo"} end + finger: fn _ -> {:ok, %{"ap_id" => "https://gensokyo.2hu/users/raymoo"}} end ) do assert Signature.key_id_to_actor_id("acct:raymoo@gensokyo.2hu") == {:ok, "https://gensokyo.2hu/users/raymoo"}