Make sure interface conversion succeeds in error check

This commit is contained in:
Tulir Asokan 2021-03-04 20:46:08 +02:00
parent 0b5eeef689
commit ab0019d087
3 changed files with 4 additions and 2 deletions

2
go.mod
View file

@ -13,7 +13,7 @@ require (
gopkg.in/yaml.v2 v2.3.0 gopkg.in/yaml.v2 v2.3.0
maunium.net/go/mauflag v1.0.0 maunium.net/go/mauflag v1.0.0
maunium.net/go/maulogger/v2 v2.2.4 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 replace github.com/Rhymen/go-whatsapp => github.com/tulir/go-whatsapp v0.4.0-rc.3

2
go.sum
View file

@ -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.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 h1:Tbx+LMN+PkJBRdHPxfWh0CVicxrAgkKPF5KGIbdJT1g=
maunium.net/go/mautrix v0.8.7-0.20210304173449-b87e026581a5/go.mod h1:mckyHSKKyI0PQF2K9MgWMMDUWH1meCNggE28ILTLuMg= 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= 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= sourcegraph.com/sourcegraph/appdash v0.0.0-20190731080439-ebfcffb1b5c0/go.mod h1:hI742Nqp5OhwiqlzhgfbWU4mW4yO10fP+LoT9WOswdU=

View file

@ -1666,7 +1666,7 @@ func (portal *Portal) HandleMediaMessage(source *User, msg mediaMessage) {
if err != nil { if err != nil {
if errors.Is(err, mautrix.MTooLarge) { if errors.Is(err, mautrix.MTooLarge) {
portal.sendMediaBridgeFailure(source, intent, msg.info, errors.New("homeserver rejected too large file")) 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")) portal.sendMediaBridgeFailure(source, intent, msg.info, errors.New("proxy rejected too large file"))
} else { } else {
portal.sendMediaBridgeFailure(source, intent, msg.info, fmt.Errorf("failed to upload media: %w", err)) portal.sendMediaBridgeFailure(source, intent, msg.info, fmt.Errorf("failed to upload media: %w", err))