Commit 772bc258 authored by lain's avatar lain
Browse files

ObjectID Validator: Refactor.

parent e67cde0e
Pipeline #24215 passed with stages
in 3 minutes and 44 seconds
......@@ -4,14 +4,14 @@ defmodule Pleroma.Web.ActivityPub.ObjectValidators.Types.ObjectID do
def type, do: :string
def cast(object) when is_binary(object) do
with %URI{
scheme: scheme,
host: host
when scheme in ["https", "http"] and not is_nil(host) <-
URI.parse(object) do
{:ok, object}
# Host has to be present and scheme has to be an http scheme (for now)
case URI.parse(object) do
%URI{host: nil} ->
%URI{scheme: scheme} when scheme in ["https", "http"] ->
{:ok, object}
_ ->
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment