Fix bridging media when whatsapp sends wrong mime type

This commit is contained in:
Tulir Asokan 2019-08-31 00:32:51 +03:00
parent 04192da0a6
commit fb826601d8

View file

@ -920,6 +920,10 @@ func (portal *Portal) HandleMediaMessage(source *User, download func() ([]byte,
return
}
// WhatsApp sends incorrect mime types 3:<
if detected := http.DetectContentType(data); detected != "application/octet-stream" {
mimeType = detected
}
uploaded, err := intent.UploadBytes(data, mimeType)
if err != nil {
portal.log.Errorfln("Failed to upload media for %s: %v", err)