diff --git a/go.mod b/go.mod index 14da724f7..f60be046f 100644 --- a/go.mod +++ b/go.mod @@ -90,7 +90,7 @@ require ( github.com/yosida95/uritemplate/v3 v3.0.2 // indirect golang.org/x/arch v0.24.0 // indirect golang.org/x/crypto v0.48.0 // indirect - golang.org/x/net v0.50.0 // indirect + golang.org/x/net v0.51.0 // indirect golang.org/x/sync v0.19.0 // indirect golang.org/x/sys v0.41.0 // indirect ) diff --git a/go.sum b/go.sum index e762e45bc..4060997f8 100644 --- a/go.sum +++ b/go.sum @@ -271,6 +271,8 @@ golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= golang.org/x/net v0.19.0/go.mod h1:CfAk/cbD4CthTvqiEl8NpboMuiuOYsAr/7NOjZJtv1U= golang.org/x/net v0.50.0 h1:ucWh9eiCGyDR3vtzso0WMQinm2Dnt8cFMuQa9K33J60= golang.org/x/net v0.50.0/go.mod h1:UgoSli3F/pBgdJBHCTc+tp3gmrU4XswgGRgtnwWTfyM= +golang.org/x/net v0.51.0 h1:94R/GTO7mt3/4wIKpcR5gkGmRLOuE/2hNGeWq/GBIFo= +golang.org/x/net v0.51.0/go.mod h1:aamm+2QF5ogm02fjy5Bb7CQ0WMt1/WVM7FtyaTLlA9Y= golang.org/x/oauth2 v0.23.0/go.mod h1:XYTD2NtWslqkgxebSiOHnXEap4TF09sJSc7H1sXbhtI= golang.org/x/oauth2 v0.35.0 h1:Mv2mzuHuZuY2+bkyWXIHMfhNdJAdwW3FuWeCPYN5GVQ= golang.org/x/oauth2 v0.35.0/go.mod h1:lzm5WQJQwKZ3nwavOZ3IS5Aulzxi68dUSgRHujetwEA= diff --git a/pkg/channels/matrix/matrix.go b/pkg/channels/matrix/matrix.go index 87dd37aa8..7d361bcf8 100644 --- a/pkg/channels/matrix/matrix.go +++ b/pkg/channels/matrix/matrix.go @@ -611,7 +611,8 @@ func (c *MatrixChannel) downloadMedia( // Encrypted attachments put URL in msgEvt.File and require client-side decryption. if msgEvt != nil && msgEvt.File != nil && msgEvt.URL == "" { - if err := msgEvt.File.DecryptInPlace(data); err != nil { + err = msgEvt.File.DecryptInPlace(data) + if err != nil { return "", fmt.Errorf("decrypt matrix media: %w", err) } } diff --git a/pkg/channels/matrix/matrix_test.go b/pkg/channels/matrix/matrix_test.go index af31c671d..6a0ad03b8 100644 --- a/pkg/channels/matrix/matrix_test.go +++ b/pkg/channels/matrix/matrix_test.go @@ -18,7 +18,7 @@ func TestMatrixLocalpartMentionRegexp(t *testing.T) { }{ {text: "@picoclaw hello", want: true}, {text: "hi @picoclaw:matrix.org", want: true}, - {text: "欢迎一下picoclaw小龙虾", want: false}, // historical false-positive case in PR #356 + {text: "\u6b22\u8fce\u4e00\u4e0bpicoclaw\u5c0f\u9f99\u867e", want: false}, // historical false-positive case in PR #356 {text: "mail test@example.com", want: false}, } @@ -87,7 +87,7 @@ func TestIsBotMentioned(t *testing.T) { { name: "localpart without at sign should not match", msg: event.MessageEventContent{ - Body: "欢迎一下picoclaw小龙虾", + Body: "\u6b22\u8fce\u4e00\u4e0bpicoclaw\u5c0f\u9f99\u867e", }, want: false, },