mirror of
https://github.com/matrix-org/dendrite.git
synced 2025-12-26 00:03:09 -06:00
Update error check to use actual error
Signed-off-by: Till Faelligen <tfaelligen@gmail.com>
This commit is contained in:
parent
3e8c91ff8b
commit
44260bba15
|
|
@ -16,8 +16,8 @@ package perform
|
|||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
federationSenderAPI "github.com/matrix-org/dendrite/federationsender/api"
|
||||
"github.com/matrix-org/dendrite/internal/config"
|
||||
|
|
@ -160,8 +160,10 @@ func (r *Inviter) PerformInvite(
|
|||
Code: api.PerformErrorNotAllowed,
|
||||
}
|
||||
|
||||
if strings.Contains(err.Error(), "value is outside of safe range") {
|
||||
log.Debug("setting error to PerformErrCanonicalJSON")
|
||||
// Ensure we send the correct http code if the json is invalid for
|
||||
// room version 6.
|
||||
if req.RoomVersion == gomatrixserverlib.RoomVersionV6 &&
|
||||
errors.Is(err, gomatrixserverlib.ErrCanonicalJSON) {
|
||||
res.Error.Code = api.PerformErrCanonicalJSON
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -496,3 +496,4 @@ Forgetting room does not show up in v2 /sync
|
|||
Can forget room you've been kicked from
|
||||
Can re-join room if re-invited
|
||||
/whois
|
||||
Outbound federation rejects invite response which include invalid JSON for room version 6
|
||||
Loading…
Reference in a new issue