diff options
author | Haelwenn (lanodan) Monnier <contact@hacktivis.me> | 2020-04-09 04:36:39 +0200 |
---|---|---|
committer | Haelwenn (lanodan) Monnier <contact@hacktivis.me> | 2020-04-09 04:36:39 +0200 |
commit | c401b00c7885823744183dbd077db9239585d20d (patch) | |
tree | 81dd32f3a0d812ae76ffd5eae8e89894600b5c94 | |
parent | 90cbf55236d93383af56364947432b04aafc525d (diff) | |
download | pleroma-c401b00c7885823744183dbd077db9239585d20d.tar.gz pleroma-c401b00c7885823744183dbd077db9239585d20d.zip |
ObjectValidators.Types.ObjectID: Fix when URI.parse returns %URL{host: ""}
-rw-r--r-- | lib/pleroma/web/activity_pub/object_validators/types/object_id.ex | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/lib/pleroma/web/activity_pub/object_validators/types/object_id.ex b/lib/pleroma/web/activity_pub/object_validators/types/object_id.ex index ee10be0b0..f6e749b33 100644 --- a/lib/pleroma/web/activity_pub/object_validators/types/object_id.ex +++ b/lib/pleroma/web/activity_pub/object_validators/types/object_id.ex @@ -6,14 +6,10 @@ defmodule Pleroma.Web.ActivityPub.ObjectValidators.Types.ObjectID do def cast(object) when is_binary(object) do # Host has to be present and scheme has to be an http scheme (for now) case URI.parse(object) do - %URI{host: nil} -> - :error - - %URI{scheme: scheme} when scheme in ["https", "http"] -> - {:ok, object} - - _ -> - :error + %URI{host: nil} -> :error + %URI{host: ""} -> :error + %URI{scheme: scheme} when scheme in ["https", "http"] -> {:ok, object} + _ -> :error end end |