X-Git-Url: https://git.squeep.com/?a=blobdiff_plain;ds=inline;f=lib%2Fpleroma%2Fsignature.ex;h=43ab569a4e70e19f0e4596898f15e0d4c19eb49c;hb=4cacce4b42e25d608390a7fd06ab21dc64529e37;hp=7006eb2c05ec6db2d16eac147ea69e67f2636597;hpb=019a192e43c2421c74e5126e753aac095db8ad54;p=akkoma
diff --git a/lib/pleroma/signature.ex b/lib/pleroma/signature.ex
index 7006eb2c0..43ab569a4 100644
--- a/lib/pleroma/signature.ex
+++ b/lib/pleroma/signature.ex
@@ -1,10 +1,11 @@
# Pleroma: A lightweight social networking server
-# Copyright © 2017-2020 Pleroma Authors
+# Copyright © 2017-2021 Pleroma Authors
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.Signature do
@behaviour HTTPSignatures.Adapter
+ alias Pleroma.EctoType.ActivityPub.ObjectValidators
alias Pleroma.Keys
alias Pleroma.User
alias Pleroma.Web.ActivityPub.ActivityPub
@@ -21,14 +22,16 @@ defmodule Pleroma.Signature do
uri
end
- case uri do
- %URI{scheme: scheme} when scheme in ["https", "http"] ->
- {:ok, URI.to_string(uri)}
+ maybe_ap_id = URI.to_string(uri)
+
+ case ObjectValidators.ObjectID.cast(maybe_ap_id) do
+ {:ok, ap_id} ->
+ {:ok, ap_id}
_ ->
- case Pleroma.Web.WebFinger.finger(URI.to_string(uri)) do
+ case Pleroma.Web.WebFinger.finger(maybe_ap_id) do
%{"ap_id" => ap_id} -> {:ok, ap_id}
- _ -> {:error, URI.to_string(uri)}
+ _ -> {:error, maybe_ap_id}
end
end
end