Merge pull request #135 from Rafaeltheraven/master

Fix #134, let whatsapp deal with mimetypes
This commit is contained in:
Tulir Asokan 2020-01-12 23:28:49 +02:00 committed by GitHub
commit 39e46833b4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -986,11 +986,6 @@ 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
}
// synapse doesn't handle webp well, so we convert it. This can be dropped once https://github.com/matrix-org/synapse/issues/4382 is fixed // synapse doesn't handle webp well, so we convert it. This can be dropped once https://github.com/matrix-org/synapse/issues/4382 is fixed
if mimeType == "image/webp" { if mimeType == "image/webp" {
img, err := webp.Decode(bytes.NewReader(data)) img, err := webp.Decode(bytes.NewReader(data))