Merge branch 'soru/fix-event-decrypt' into 'master'
fix decryption of some events throwing an error See merge request famedly/famedlysdk!306
This commit is contained in:
commit
3b1c81b4c7
|
@ -1780,7 +1780,7 @@ class Room {
|
||||||
/// Returns a m.bad.encrypted event if it fails and does nothing if the event
|
/// Returns a m.bad.encrypted event if it fails and does nothing if the event
|
||||||
/// was not encrypted.
|
/// was not encrypted.
|
||||||
Event decryptGroupMessage(Event event) {
|
Event decryptGroupMessage(Event event) {
|
||||||
if (event.type != EventTypes.Encrypted) return event;
|
if (event.type != EventTypes.Encrypted || event.content['ciphertext'] == null) return event;
|
||||||
Map<String, dynamic> decryptedPayload;
|
Map<String, dynamic> decryptedPayload;
|
||||||
try {
|
try {
|
||||||
if (!client.encryptionEnabled) {
|
if (!client.encryptionEnabled) {
|
||||||
|
@ -1820,7 +1820,7 @@ class Room {
|
||||||
decryptedPayload['content']['msgtype'] = 'm.bad.encrypted';
|
decryptedPayload['content']['msgtype'] = 'm.bad.encrypted';
|
||||||
} else {
|
} else {
|
||||||
decryptedPayload = {
|
decryptedPayload = {
|
||||||
'content': {
|
'content': <String, dynamic>{
|
||||||
'msgtype': 'm.bad.encrypted',
|
'msgtype': 'm.bad.encrypted',
|
||||||
'body': exception.toString(),
|
'body': exception.toString(),
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in a new issue