Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F33102665
object_id.ex
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Award Token
Flag For Later
Size
741 B
Referenced Files
None
Subscribers
None
object_id.ex
View Options
# Pleroma: A lightweight social networking server
# Copyright © 2017-2022 Pleroma Authors <https://pleroma.social/>
# SPDX-License-Identifier: AGPL-3.0-only
defmodule
Pleroma.EctoType.ActivityPub.ObjectValidators.ObjectID
do
use
Ecto.Type
def
type
,
do
:
:string
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
{
host
:
""
}
->
:error
%
URI
{
scheme
:
scheme
}
when
scheme
in
[
"https"
,
"http"
]
->
{
:ok
,
object
}
_
->
:error
end
end
def
cast
(%{
"id"
=>
object
}),
do
:
cast
(
object
)
def
cast
(
_
),
do
:
:error
def
dump
(
data
),
do
:
{
:ok
,
data
}
def
load
(
data
),
do
:
{
:ok
,
data
}
end
File Metadata
Details
Attached
Mime Type
text/x-ruby
Expires
Tue, Jan 20, 1:10 PM (1 d, 9 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
931477
Default Alt Text
object_id.ex (741 B)
Attached To
Mode
rPUBE pleroma-upstream
Attached
Detach File
Event Timeline
Log In to Comment