commit: 88042109a3590db25dd9e39f353b1456cbd4e44b
parent 7f649a7a19ae5f236dc21aaa11bb9a33c72dabbf
Author: Mark Felder <feld@feld.me>
Date: Sat, 20 Jan 2024 17:56:32 -0500
Dialyzer: fix pattern match coverage
Diffstat:
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/lib/pleroma/ecto_type/activity_pub/object_validators/bare_uri.ex b/lib/pleroma/ecto_type/activity_pub/object_validators/bare_uri.ex
@@ -8,10 +8,12 @@ defmodule Pleroma.EctoType.ActivityPub.ObjectValidators.BareUri do
def type, do: :string
def cast(uri) when is_binary(uri) do
- case URI.parse(uri) do
- %URI{scheme: nil} -> :error
- %URI{} -> {:ok, uri}
- _ -> :error
+ parsed = URI.parse(uri)
+
+ if is_nil(parsed.scheme) do
+ :error
+ else
+ {:ok, uri}
end
end