Add mediaType to federated attachments + fix image description. For #1840

This commit is contained in:
Gabe Kangas
2022-04-27 16:31:49 -07:00
parent a1377c3338
commit b378728eba
2 changed files with 11 additions and 4 deletions

View File

@@ -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)
}
}