Replace null values when converting bytes to string in graph-node host API (#523)

* Replace null value in strings for postgres text data type

* Upgrade package versions to 0.2.99
This commit is contained in:
2024-06-14 13:47:54 +05:30
committed by GitHub
parent 9c4b06652e
commit 981f70ec9b
15 changed files with 41 additions and 37 deletions
+5 -1
View File
@@ -340,7 +340,11 @@ export const instantiate = async (
},
'typeConversion.bytesToString': async (bytes: number) => {
const byteArray = __getArray(bytes);
const string = utils.toUtf8String(byteArray, utils.Utf8ErrorFuncs.replace);
let string = utils.toUtf8String(byteArray, utils.Utf8ErrorFuncs.replace);
// Replace \x00 with empty string as Postgres DB text data type does not support it
string = string.replaceAll('\x00', '');
const ptr = await __newString(string);
return ptr;