projects
/
akkoma
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
e67cde0
)
ObjectID Validator: Refactor.
author
lain
<lain@soykaf.club>
Mon, 6 Apr 2020 11:53:24 +0000
(13:53 +0200)
committer
lain
<lain@soykaf.club>
Mon, 6 Apr 2020 11:53:24 +0000
(13:53 +0200)
lib/pleroma/web/activity_pub/object_validators/types/object_id.ex
patch
|
blob
|
history
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 8e70effe416d6cb230dbc63965f8964801497cd0..ee10be0b0d0417d7672bdbc5f1748901640757cf 100644
(file)
--- a/
lib/pleroma/web/activity_pub/object_validators/types/object_id.ex
+++ b/
lib/pleroma/web/activity_pub/object_validators/types/object_id.ex
@@
-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}
- else
+ # 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
end