Update mautrix-go again

This commit is contained in:
Tulir Asokan 2022-04-27 19:04:34 +03:00
parent 2259b5007f
commit 387148849a
4 changed files with 7 additions and 7 deletions

2
go.mod
View file

@ -17,7 +17,7 @@ require (
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b
maunium.net/go/mauflag v1.0.0
maunium.net/go/maulogger/v2 v2.3.2
maunium.net/go/mautrix v0.10.13-0.20220427112957-a59522681515
maunium.net/go/mautrix v0.10.13-0.20220427124931-09c8c43908d4
)
require (

4
go.sum
View file

@ -197,5 +197,5 @@ maunium.net/go/mauflag v1.0.0 h1:YiaRc0tEI3toYtJMRIfjP+jklH45uDHtT80nUamyD4M=
maunium.net/go/mauflag v1.0.0/go.mod h1:nLivPOpTpHnpzEh8jEdSL9UqO9+/KBJFmNRlwKfkPeA=
maunium.net/go/maulogger/v2 v2.3.2 h1:1XmIYmMd3PoQfp9J+PaHhpt80zpfmMqaShzUTC7FwY0=
maunium.net/go/maulogger/v2 v2.3.2/go.mod h1:TYWy7wKwz/tIXTpsx8G3mZseIRiC5DoMxSZazOHy68A=
maunium.net/go/mautrix v0.10.13-0.20220427112957-a59522681515 h1:n+faOlwr44gHYPLa8eWq0QHYBkePUWzg3IKSGJkTLk8=
maunium.net/go/mautrix v0.10.13-0.20220427112957-a59522681515/go.mod h1:lm1eZygpN3wlLyexPh+Z56DEvOuC4tY5/JacJWr+/AE=
maunium.net/go/mautrix v0.10.13-0.20220427124931-09c8c43908d4 h1:DSAVqAG/Bw2uxfro1JhNvGKK6HJxSefw5Y/7hnPiEzU=
maunium.net/go/mautrix v0.10.13-0.20220427124931-09c8c43908d4/go.mod h1:lm1eZygpN3wlLyexPh+Z56DEvOuC4tY5/JacJWr+/AE=

View file

@ -1952,7 +1952,7 @@ func (portal *Portal) encryptFileInPlace(data []byte, mimeType string) (string,
EncryptedFile: *attachment.NewEncryptedFile(),
URL: "",
}
file.Encrypt(data)
file.EncryptInPlace(data)
return "application/octet-stream", file
}
@ -2458,7 +2458,7 @@ func (portal *Portal) preprocessMatrixMedia(sender *User, relaybotFormatted bool
return nil
}
if file != nil {
err = file.Decrypt(data)
err = file.DecryptInPlace(data)
if err != nil {
portal.log.Errorfln("Failed to decrypt media in %s: %v", eventID, err)
return nil

View file

@ -89,7 +89,7 @@ func (portal *Portal) convertURLPreviewToBeeper(intent *appservice.IntentAPI, so
uploadData, uploadMime := thumbnailData, output.ImageType
if portal.Encrypted {
crypto := attachment.NewEncryptedFile()
crypto.Encrypt(uploadData)
crypto.EncryptInPlace(uploadData)
uploadMime = "application/octet-stream"
output.ImageEncryption = &event.EncryptedFileInfo{EncryptedFile: *crypto}
}
@ -169,7 +169,7 @@ func (portal *Portal) convertURLPreviewToWhatsApp(sender *User, evt *event.Event
return true
}
if preview.ImageEncryption != nil {
err = preview.ImageEncryption.Decrypt(data)
err = preview.ImageEncryption.DecryptInPlace(data)
if err != nil {
portal.log.Errorfln("Failed to decrypt URL preview image in %s: %v", evt.ID, err)
return true