fix detect the type of media message
This commit is contained in:
parent
9bb85282de
commit
e91fa5506c
1
go.mod
1
go.mod
|
@ -4,6 +4,7 @@ go 1.14
|
|||
|
||||
require (
|
||||
github.com/chai2010/webp v1.1.0
|
||||
github.com/gabriel-vasile/mimetype v1.1.2
|
||||
github.com/gorilla/websocket v1.4.2
|
||||
github.com/kelaresg/go-skypeapi v0.1.2-0.20210220112556-a87881796d7b
|
||||
github.com/lib/pq v1.7.0
|
||||
|
|
2
go.sum
2
go.sum
|
@ -64,6 +64,8 @@ github.com/dgryski/go-sip13 v0.0.0-20181026042036-e10d5fee7954/go.mod h1:vAd38F8
|
|||
github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4=
|
||||
github.com/fsnotify/fsnotify v1.4.7 h1:IXs+QLmnXW2CcXuY+8Mzv/fWEsPGWxqefPtCP5CnV9I=
|
||||
github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
|
||||
github.com/gabriel-vasile/mimetype v1.1.2 h1:gaPnPcNor5aZSVCJVSGipcpbgMWiAAj9z182ocSGbHU=
|
||||
github.com/gabriel-vasile/mimetype v1.1.2/go.mod h1:6CDPel/o/3/s4+bp6kIbsWATq8pmgOisOPG40CJa6To=
|
||||
github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04=
|
||||
github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU=
|
||||
github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as=
|
||||
|
|
|
@ -2,6 +2,7 @@ package main
|
|||
|
||||
import (
|
||||
"bytes"
|
||||
"github.com/gabriel-vasile/mimetype"
|
||||
"maunium.net/go/mautrix/patch"
|
||||
|
||||
"encoding/hex"
|
||||
|
@ -1622,8 +1623,7 @@ func (portal *Portal) HandleMediaMessageSkype(source *User, download func(conn *
|
|||
}
|
||||
|
||||
// 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
|
||||
mimeType := http.DetectContentType(data)
|
||||
//length := len(data)
|
||||
mimeType := mimetype.Detect(data).String()
|
||||
if mimeType == "image/webp" {
|
||||
img, err := decodeWebp(bytes.NewReader(data))
|
||||
if err != nil {
|
||||
|
|
Loading…
Reference in New Issue