Don't return pointer from NewImageAttachment()

This commit is contained in:
Matt Baer
2021-03-24 15:47:23 -04:00
parent f534cc9f9b
commit 8dbd86535d
+2 -2
View File
@@ -19,13 +19,13 @@ 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 {
func NewImageAttachment(url string) Attachment {
var imgType string
extIdx := strings.LastIndexByte(url, '.')
if extIdx > -1 {
imgType = mime.TypeByExtension(url[extIdx:])
}
return &Attachment{
return Attachment{
Type: AttachImage,
URL: url,
MediaType: imgType,