Don't return pointer from NewImageAttachment()
This commit is contained in:
@@ -19,13 +19,13 @@ const AttachImage AttachmentType = "Image"
|
|||||||
// NewImageAttachment creates a new Attachment from the given URL, setting the
|
// NewImageAttachment creates a new Attachment from the given URL, setting the
|
||||||
// correct type and automatically detecting the MediaType based on the file
|
// correct type and automatically detecting the MediaType based on the file
|
||||||
// extension.
|
// extension.
|
||||||
func NewImageAttachment(url string) *Attachment {
|
func NewImageAttachment(url string) Attachment {
|
||||||
var imgType string
|
var imgType string
|
||||||
extIdx := strings.LastIndexByte(url, '.')
|
extIdx := strings.LastIndexByte(url, '.')
|
||||||
if extIdx > -1 {
|
if extIdx > -1 {
|
||||||
imgType = mime.TypeByExtension(url[extIdx:])
|
imgType = mime.TypeByExtension(url[extIdx:])
|
||||||
}
|
}
|
||||||
return &Attachment{
|
return Attachment{
|
||||||
Type: AttachImage,
|
Type: AttachImage,
|
||||||
URL: url,
|
URL: url,
|
||||||
MediaType: imgType,
|
MediaType: imgType,
|
||||||
|
|||||||
Reference in New Issue
Block a user