From ab0019d087eb4d3304774c612bb41254c77ac4a9 Mon Sep 17 00:00:00 2001 From: Tulir Asokan Date: Thu, 4 Mar 2021 20:46:08 +0200 Subject: [PATCH] Make sure interface conversion succeeds in error check --- go.mod | 2 +- go.sum | 2 ++ portal.go | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/go.mod b/go.mod index d8bb2a7..5a775bb 100644 --- a/go.mod +++ b/go.mod @@ -13,7 +13,7 @@ require ( gopkg.in/yaml.v2 v2.3.0 maunium.net/go/mauflag v1.0.0 maunium.net/go/maulogger/v2 v2.2.4 - maunium.net/go/mautrix v0.8.7-0.20210304173449-b87e026581a5 + maunium.net/go/mautrix v0.9.0 ) replace github.com/Rhymen/go-whatsapp => github.com/tulir/go-whatsapp v0.4.0-rc.3 diff --git a/go.sum b/go.sum index afb7f33..f8476d2 100644 --- a/go.sum +++ b/go.sum @@ -492,5 +492,7 @@ maunium.net/go/mautrix v0.8.7-0.20210304173149-2ab811a476a6 h1:Nsoc66dDiB/PDwqFm maunium.net/go/mautrix v0.8.7-0.20210304173149-2ab811a476a6/go.mod h1:mckyHSKKyI0PQF2K9MgWMMDUWH1meCNggE28ILTLuMg= maunium.net/go/mautrix v0.8.7-0.20210304173449-b87e026581a5 h1:Tbx+LMN+PkJBRdHPxfWh0CVicxrAgkKPF5KGIbdJT1g= maunium.net/go/mautrix v0.8.7-0.20210304173449-b87e026581a5/go.mod h1:mckyHSKKyI0PQF2K9MgWMMDUWH1meCNggE28ILTLuMg= +maunium.net/go/mautrix v0.9.0 h1:+u2NDmNWUwOqUmlQgDiDo9gE0XLPqfB0UeZYwx9XghI= +maunium.net/go/mautrix v0.9.0/go.mod h1:mckyHSKKyI0PQF2K9MgWMMDUWH1meCNggE28ILTLuMg= sigs.k8s.io/yaml v1.1.0/go.mod h1:UJmg0vDUVViEyp3mgSv9WPwZCDxu4rQW1olrI1uml+o= sourcegraph.com/sourcegraph/appdash v0.0.0-20190731080439-ebfcffb1b5c0/go.mod h1:hI742Nqp5OhwiqlzhgfbWU4mW4yO10fP+LoT9WOswdU= diff --git a/portal.go b/portal.go index e77b22f..7c2f9e0 100644 --- a/portal.go +++ b/portal.go @@ -1666,7 +1666,7 @@ func (portal *Portal) HandleMediaMessage(source *User, msg mediaMessage) { if err != nil { if errors.Is(err, mautrix.MTooLarge) { portal.sendMediaBridgeFailure(source, intent, msg.info, errors.New("homeserver rejected too large file")) - } else if httpErr := err.(mautrix.HTTPError); httpErr.IsStatus(413) { + } else if httpErr, ok := err.(mautrix.HTTPError); ok && httpErr.IsStatus(413) { portal.sendMediaBridgeFailure(source, intent, msg.info, errors.New("proxy rejected too large file")) } else { portal.sendMediaBridgeFailure(source, intent, msg.info, fmt.Errorf("failed to upload media: %w", err))