Dialyzer: fix pattern match coverage

This commit is contained in:
Mark Felder 2024-01-20 17:56:32 -05:00
parent 7f649a7a19
commit 88042109a3

View File

@ -8,10 +8,12 @@ defmodule Pleroma.EctoType.ActivityPub.ObjectValidators.BareUri do
def type, do: :string def type, do: :string
def cast(uri) when is_binary(uri) do def cast(uri) when is_binary(uri) do
case URI.parse(uri) do parsed = URI.parse(uri)
%URI{scheme: nil} -> :error
%URI{} -> {:ok, uri} if is_nil(parsed.scheme) do
_ -> :error :error
else
{:ok, uri}
end end
end end