aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/pleroma/web/activity_pub/object_validators/types/object.ex16
1 files changed, 12 insertions, 4 deletions
diff --git a/lib/pleroma/web/activity_pub/object_validators/types/object.ex b/lib/pleroma/web/activity_pub/object_validators/types/object.ex
index 92fc13ba8..8e70effe4 100644
--- a/lib/pleroma/web/activity_pub/object_validators/types/object.ex
+++ b/lib/pleroma/web/activity_pub/object_validators/types/object.ex
@@ -4,12 +4,20 @@ defmodule Pleroma.Web.ActivityPub.ObjectValidators.Types.ObjectID do
def type, do: :string
def cast(object) when is_binary(object) do
- {:ok, object}
+ with %URI{
+ scheme: scheme,
+ host: host
+ }
+ when scheme in ["https", "http"] and not is_nil(host) <-
+ URI.parse(object) do
+ {:ok, object}
+ else
+ _ ->
+ :error
+ end
end
- def cast(%{"id" => object}) when is_binary(object) do
- {:ok, object}
- end
+ def cast(%{"id" => object}), do: cast(object)
def cast(_) do
:error