Add mediaType to federated attachments + fix image description. For #1840
This commit is contained in:
@@ -76,18 +76,21 @@ func SendLive() error {
|
||||
previewURL, err := url.Parse(data.GetServerURL())
|
||||
if err == nil {
|
||||
var imageToAttach string
|
||||
var mediaType string
|
||||
previewGif := filepath.Join(config.WebRoot, "preview.gif")
|
||||
thumbnailJpg := filepath.Join(config.WebRoot, "thumbnail.jpg")
|
||||
uniquenessString := shortid.MustGenerate()
|
||||
if utils.DoesFileExists(previewGif) {
|
||||
imageToAttach = "preview.gif"
|
||||
mediaType = "image/gif"
|
||||
} else if utils.DoesFileExists(thumbnailJpg) {
|
||||
imageToAttach = "thumbnail.jpg"
|
||||
mediaType = "image/jpeg"
|
||||
}
|
||||
if imageToAttach != "" {
|
||||
previewURL.Path = imageToAttach
|
||||
previewURL.RawQuery = "us=" + uniquenessString
|
||||
apmodels.AddImageAttachmentToNote(note, previewURL.String())
|
||||
apmodels.AddImageAttachmentToNote(note, previewURL.String(), mediaType)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user