forked from MirrorHub/mautrix-whatsapp
Fix bridging media when whatsapp sends wrong mime type
This commit is contained in:
parent
04192da0a6
commit
fb826601d8
1 changed files with 4 additions and 0 deletions
|
@ -920,6 +920,10 @@ func (portal *Portal) HandleMediaMessage(source *User, download func() ([]byte,
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// WhatsApp sends incorrect mime types 3:<
|
||||||
|
if detected := http.DetectContentType(data); detected != "application/octet-stream" {
|
||||||
|
mimeType = detected
|
||||||
|
}
|
||||||
uploaded, err := intent.UploadBytes(data, mimeType)
|
uploaded, err := intent.UploadBytes(data, mimeType)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
portal.log.Errorfln("Failed to upload media for %s: %v", err)
|
portal.log.Errorfln("Failed to upload media for %s: %v", err)
|
||||||
|
|
Loading…
Reference in a new issue