checking if the event is an image message to avoid attepting to render non image based attachments

This commit is contained in:
Adam Brown 2021-11-04 10:10:36 +00:00
parent 431f060209
commit 9e6bd2ee9c
1 changed files with 2 additions and 1 deletions

View File

@ -30,6 +30,7 @@ import org.matrix.android.sdk.api.session.crypto.MXCryptoError
import org.matrix.android.sdk.api.session.events.model.Event
import org.matrix.android.sdk.api.session.events.model.EventType
import org.matrix.android.sdk.api.session.events.model.isEdition
import org.matrix.android.sdk.api.session.events.model.isImageMessage
import org.matrix.android.sdk.api.session.events.model.toModel
import org.matrix.android.sdk.api.session.room.model.Membership
import org.matrix.android.sdk.api.session.room.model.RoomMemberContent
@ -202,7 +203,7 @@ class NotifiableEventResolver @Inject constructor(
private suspend fun TimelineEvent.fetchImageIfPresent(session: Session): Uri? {
return when {
root.isEncrypted() && root.mxDecryptionResult == null -> null
root.getClearType() == EventType.MESSAGE -> downloadAndExportImage(session)
root.isImageMessage() -> downloadAndExportImage(session)
else -> null
}
}