From a1140fd8fa26e0e9361b84b895c4c32c44efd75e Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Thu, 1 Feb 2024 17:28:29 +0100 Subject: [PATCH] Improve getClearContent() method: it should not fallback to the encrypted content when the content is not decrypted. --- .../android/sdk/api/session/events/model/Event.kt | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/events/model/Event.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/events/model/Event.kt index bad8b3766d..196b419598 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/events/model/Event.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/events/model/Event.kt @@ -219,10 +219,16 @@ data class Event( } /** - * @return the event content + * @return the event content. + * If the content is encrypted, it will return the decrypted content, or null if the content is not + * decrypted. */ fun getClearContent(): Content? { - return getDecryptedContent() ?: content + return if (isEncrypted()) { + getDecryptedContent() + } else { + content + } } /**