diff --git a/LIBCWTCH-GO-MACOS.version b/LIBCWTCH-GO-MACOS.version index 0a394075..d97a086c 100644 --- a/LIBCWTCH-GO-MACOS.version +++ b/LIBCWTCH-GO-MACOS.version @@ -1 +1 @@ -2022-12-06-12-16-v1.10.0-8-g137027d \ No newline at end of file +2022-12-07-17-51-v1.10.1 \ No newline at end of file diff --git a/LIBCWTCH-GO.version b/LIBCWTCH-GO.version index 4f9aff94..43e720bb 100644 --- a/LIBCWTCH-GO.version +++ b/LIBCWTCH-GO.version @@ -1 +1 @@ -2022-12-06-17-15-v1.10.0-8-g137027d \ No newline at end of file +2022-12-07-22-53-v1.10.1 \ No newline at end of file diff --git a/lib/models/messages/filemessage.dart b/lib/models/messages/filemessage.dart index 7c139822..e3e972c9 100644 --- a/lib/models/messages/filemessage.dart +++ b/lib/models/messages/filemessage.dart @@ -22,27 +22,31 @@ class FileMessage extends Message { return ChangeNotifierProvider.value( value: this.metadata, builder: (bcontext, child) { - dynamic shareObj = jsonDecode(this.content); - if (shareObj == null) { - return MessageRow(MalformedBubble(), index); - } - String nameSuggestion = shareObj['f'] as String; - String rootHash = shareObj['h'] as String; - String nonce = shareObj['n'] as String; - int fileSize = shareObj['s'] as int; - String fileKey = rootHash + "." + nonce; - - if (metadata.attributes["file-downloaded"] == "true") { - if (!Provider.of(context).downloadKnown(fileKey)) { - Provider.of(context, listen: false).cwtch.CheckDownloadStatus(Provider.of(context, listen: false).onion, fileKey); + try { + dynamic shareObj = jsonDecode(this.content); + if (shareObj == null) { + return MessageRow(MalformedBubble(), index); } - } + String nameSuggestion = shareObj['f'] as String; + String rootHash = shareObj['h'] as String; + String nonce = shareObj['n'] as String; + int fileSize = shareObj['s'] as int; + String fileKey = rootHash + "." + nonce; - if (!validHash(rootHash, nonce)) { + if (metadata.attributes["file-downloaded"] == "true") { + if (!Provider.of(context).downloadKnown(fileKey)) { + Provider.of(context, listen: false).cwtch.CheckDownloadStatus(Provider.of(context, listen: false).onion, fileKey); + } + } + + if (!validHash(rootHash, nonce)) { + return MessageRow(MalformedBubble(), index); + } + + return MessageRow(FileBubble(nameSuggestion, rootHash, nonce, fileSize, isAuto: metadata.isAuto), index, key: key); + } catch (e) { return MessageRow(MalformedBubble(), index); } - - return MessageRow(FileBubble(nameSuggestion, rootHash, nonce, fileSize, isAuto: metadata.isAuto), index, key: key); }); }