From 0369b9c9782770f912cc3cb29369fde9e9dfed6a Mon Sep 17 00:00:00 2001 From: eifrah-aws Date: Tue, 18 Jun 2024 10:29:44 +0300 Subject: [PATCH] Node: convert `VerbatimString` into `Uint8Array` (#1588) Node: convert `VerbatimString` into Uint8Array --- node/rust-client/src/lib.rs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/node/rust-client/src/lib.rs b/node/rust-client/src/lib.rs index ed1ffb22e9..0de3d2bae8 100644 --- a/node/rust-client/src/lib.rs +++ b/node/rust-client/src/lib.rs @@ -189,9 +189,12 @@ fn redis_value_to_js(val: Value, js_env: Env) -> Result { // "Normal client libraries may ignore completely the difference between this" // "type and the String type, and return a string in both cases."" // https://github.com/redis/redis-specifications/blob/master/protocol/RESP3.md - Value::VerbatimString { format: _, text } => js_env - .create_string_from_std(text) - .map(|val| val.into_unknown()), + Value::VerbatimString { format: _, text } => { + // VerbatimString is binary safe -> convert it into such + Ok(js_env + .create_buffer_with_data(text.as_bytes().to_vec())? + .into_unknown()) + } Value::BigNumber(num) => { let sign = num.is_negative(); let words = num.iter_u64_digits().collect();