bridgev2/matrix: return error if trying to encrypt message without encryption enabled
Some checks are pending
Go / Lint (latest) (push) Waiting to run
Go / Build (old, libolm) (push) Waiting to run
Go / Build (latest, libolm) (push) Waiting to run
Go / Build (old, goolm) (push) Waiting to run
Go / Build (latest, goolm) (push) Waiting to run

This commit is contained in:
Tulir Asokan 2024-08-17 14:10:04 +03:00
commit 2355d70426

View file

@ -56,6 +56,9 @@ func (as *ASIntent) SendMessage(ctx context.Context, roomID id.RoomID, eventType
if encrypted, err := as.Matrix.StateStore.IsEncrypted(ctx, roomID); err != nil {
return nil, fmt.Errorf("failed to check if room is encrypted: %w", err)
} else if encrypted {
if as.Connector.Crypto == nil {
return nil, fmt.Errorf("room is encrypted, but bridge isn't configured to support encryption")
}
if as.Matrix.IsCustomPuppet {
if extra.Timestamp.IsZero() {
as.Matrix.AddDoublePuppetValue(content)