From c8e5c06a57892bc7c1fa75e187aa1d4d1800c0ec Mon Sep 17 00:00:00 2001 From: rafaeltheraven Date: Thu, 9 Jan 2020 10:41:45 +0100 Subject: [PATCH 1/2] Removed strange workaround, fixing #134 --- portal.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/portal.go b/portal.go index bce80d7..d7c3cd7 100644 --- a/portal.go +++ b/portal.go @@ -987,9 +987,10 @@ func (portal *Portal) HandleMediaMessage(source *User, download func() ([]byte, } // WhatsApp sends incorrect mime types 3:< - if detected := http.DetectContentType(data); detected != "application/octet-stream" { - mimeType = detected - } + portal.log.Debugfln("Before conversion: %s", mimeType) + //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 if mimeType == "image/webp" { From 6d806227c72e9f4c9277ab89cf3791f341f56a37 Mon Sep 17 00:00:00 2001 From: rafaeltheraven Date: Thu, 9 Jan 2020 10:46:45 +0100 Subject: [PATCH 2/2] Actually removed instead of commenting out :P --- portal.go | 6 ------ 1 file changed, 6 deletions(-) diff --git a/portal.go b/portal.go index d7c3cd7..dbbc2c6 100644 --- a/portal.go +++ b/portal.go @@ -986,12 +986,6 @@ func (portal *Portal) HandleMediaMessage(source *User, download func() ([]byte, return } - // WhatsApp sends incorrect mime types 3:< - portal.log.Debugfln("Before conversion: %s", mimeType) - //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 if mimeType == "image/webp" { img, err := webp.Decode(bytes.NewReader(data))