From 0e47a96180ed111adb4ab7a7c93f1f8251789ba7 Mon Sep 17 00:00:00 2001 From: Serhii Shymkiv Date: Wed, 24 Apr 2024 10:04:57 +0300 Subject: [PATCH] Fix for control chars in memo. --- index.html | 4 ++-- js/app.js | 12 +----------- js/constants.js | 4 ++-- 3 files changed, 5 insertions(+), 15 deletions(-) diff --git a/index.html b/index.html index 3a2983f..86d263a 100644 --- a/index.html +++ b/index.html @@ -422,7 +422,7 @@

{{header}}

Memo:
-
{{memoView}}
+
{{memo}}
{{/memo}} @@ -500,7 +500,7 @@

{{header}}

Memo:
- {{memoView}} + {{zkappCommand.memo}}
{{/zkappCommand.memo}} diff --git a/js/app.js b/js/app.js index a9e0c97..e19657d 100644 --- a/js/app.js +++ b/js/app.js @@ -646,11 +646,6 @@ hashView: function () { return ellipsify(this.hash); }, - memoView: function () { - return this - ? this.replace(RegExp(String.fromCharCode(28), "g"), "") - : ""; - }, feePayerView: function () { return ellipsify(this.feePayer.publicKey); }, @@ -680,11 +675,6 @@ hashView: function () { return ellipsify(this.hash); }, - memoView: function () { - return this - ? this.replace(RegExp(String.fromCharCode(28), "g"), "") - : ""; - }, feePayerView: function () { return ellipsify(this.zkappCommand.feePayer.body.publicKey); }, @@ -1173,7 +1163,7 @@ const decodedString = new TextDecoder().decode( decodedMessage.slice(2, decodedMessage.length - 4) ); - return decodedString.replace(nullValueRegex, ""); + return decodedString.replace(controlCharsRegExp, ""); } function updateBlocksWithFailedTxnMark(blocks) { diff --git a/js/constants.js b/js/constants.js index 9af2ec5..22ba1e5 100644 --- a/js/constants.js +++ b/js/constants.js @@ -1,11 +1,11 @@ // Update application version for every new release -const applicationVersion = "v0.2.0"; +const applicationVersion = "v0.2.1"; const timeZoneOffset = new Date().getTimezoneOffset() * 60000; const minaTokenId = "wSHV2S4qX9jFsLjQo8r1BsMLH2ZRKsZx6EJd1sbozGPieEC4Jf"; const base58Alphabet = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"; -const nullValueRegex = /\0[\s\S]*$/g; +const controlCharsRegExp = /[\x00-\x1F\x7F]/g; const themes = [ "light", "dark",