From 66034b6e8d41d31cc504f810846dd407257a5c3b Mon Sep 17 00:00:00 2001 From: Joshua Goins Date: Thu, 18 Jul 2024 14:08:10 -0400 Subject: [PATCH] Patch fixing redux: Trim trailing null characters This fixes broken file operations --- src/common_file_operations.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/common_file_operations.rs b/src/common_file_operations.rs index 2295426..88b5ace 100644 --- a/src/common_file_operations.rs +++ b/src/common_file_operations.rs @@ -19,7 +19,8 @@ pub(crate) fn write_bool_as>(x: &bool) -> T { } pub(crate) fn read_string(byte_stream: Vec) -> String { - String::from_utf8(byte_stream).unwrap() + let str = String::from_utf8(byte_stream).unwrap(); + str.trim_matches(char::from(0)).to_string() // trim \0 from the end of strings } pub(crate) fn write_string(str: &String) -> Vec {