Page Menu
Home
Musing Studio
Search
Configure Global Search
Log In
Files
F14174632
attachment.go
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
762 B
Subscribers
None
attachment.go
View Options
package
activitystreams
import
(
"mime"
"strings"
)
type
Attachment
struct
{
Type
AttachmentType
`json:"type"`
URL
string
`json:"url"`
MediaType
string
`json:"mediaType"`
Name
string
`json:"name"`
}
type
AttachmentType
string
const
AttachImage
AttachmentType
=
"Image"
// NewImageAttachment creates a new Attachment from the given URL, setting the
// correct type and automatically detecting the MediaType based on the file
// extension.
func
NewImageAttachment
(
url
string
)
*
Attachment
{
var
imgType
string
extIdx
:=
strings
.
LastIndexByte
(
url
,
'.'
)
if
extIdx
>
-
1
{
imgType
=
mime
.
TypeByExtension
(
url
[
extIdx
:])
}
return
&
Attachment
{
Type
:
AttachImage
,
URL
:
url
,
MediaType
:
imgType
,
}
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Thu, Apr 2, 4:21 AM (1 d, 17 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3677799
Attached To
rWC Write.as Web Core
Event Timeline
Log In to Comment