From 99ff0c0964e4aeb9e58004193590e8ba782b3c78 Mon Sep 17 00:00:00 2001 From: Tulir Asokan Date: Mon, 14 Apr 2025 23:08:11 +0300 Subject: [PATCH] crypto/decryptmegolm: add option to ignore failing to parse content after decryption --- crypto/decryptmegolm.go | 2 +- crypto/machine.go | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/crypto/decryptmegolm.go b/crypto/decryptmegolm.go index 11ab0f49..47279474 100644 --- a/crypto/decryptmegolm.go +++ b/crypto/decryptmegolm.go @@ -160,7 +160,7 @@ func (mach *OlmMachine) DecryptMegolmEvent(ctx context.Context, evt *event.Event if err != nil { if errors.Is(err, event.ErrUnsupportedContentType) { log.Warn().Msg("Unsupported event type in encrypted event") - } else { + } else if !mach.IgnorePostDecryptionParseErrors { return nil, fmt.Errorf("failed to parse content of megolm payload event: %w", err) } } diff --git a/crypto/machine.go b/crypto/machine.go index cacc73b6..e2af298b 100644 --- a/crypto/machine.go +++ b/crypto/machine.go @@ -44,6 +44,8 @@ type OlmMachine struct { // Don't mark outbound Olm sessions as shared for devices they were initially sent to. DisableSharedGroupSessionTracking bool + IgnorePostDecryptionParseErrors bool + SendKeysMinTrust id.TrustState ShareKeysMinTrust id.TrustState