From 5bda3f22ec842beb7bd9ed9e467f09f8770cf153 Mon Sep 17 00:00:00 2001 From: Liza Dymchenko Date: Tue, 16 Aug 2022 22:54:24 +0200 Subject: [PATCH 1/3] fix utf8 crashing --- descartes/src/descartes.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/descartes/src/descartes.rs b/descartes/src/descartes.rs index 6d21767..7415e2b 100644 --- a/descartes/src/descartes.rs +++ b/descartes/src/descartes.rs @@ -111,7 +111,10 @@ impl From<&DriveParsed> for Drive { .take_while(|&n| *n != 0) .map(|&n| n) .collect(); - Ok(String::from_utf8(removed_trailing_zeros).unwrap()) + Ok(match String::from_utf8(removed_trailing_zeros) { + Ok(valid) => valid, + Err(_) => {String::from("")} + }) }) .unwrap(), root_hash: parsed.4, From cfd1c2e66b1dcc613f526119d7818e9e1eb1516c Mon Sep 17 00:00:00 2001 From: dymchenkko Date: Fri, 19 Aug 2022 08:35:01 +0200 Subject: [PATCH 2/3] original --- descartes/src/descartes.rs | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/descartes/src/descartes.rs b/descartes/src/descartes.rs index 7415e2b..f313b19 100644 --- a/descartes/src/descartes.rs +++ b/descartes/src/descartes.rs @@ -111,10 +111,7 @@ impl From<&DriveParsed> for Drive { .take_while(|&n| *n != 0) .map(|&n| n) .collect(); - Ok(match String::from_utf8(removed_trailing_zeros) { - Ok(valid) => valid, - Err(_) => {String::from("")} - }) + Ok(String::from_utf8(removed_trailing_zeros).unwrap()) }) .unwrap(), root_hash: parsed.4, From aad50fdbcaad0ef56efc0ad94c39320f2d11857a Mon Sep 17 00:00:00 2001 From: dymchenkko Date: Fri, 19 Aug 2022 08:36:13 +0200 Subject: [PATCH 3/3] fix utf8 crashing --- descartes/src/descartes.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/descartes/src/descartes.rs b/descartes/src/descartes.rs index f313b19..7415e2b 100644 --- a/descartes/src/descartes.rs +++ b/descartes/src/descartes.rs @@ -111,7 +111,10 @@ impl From<&DriveParsed> for Drive { .take_while(|&n| *n != 0) .map(|&n| n) .collect(); - Ok(String::from_utf8(removed_trailing_zeros).unwrap()) + Ok(match String::from_utf8(removed_trailing_zeros) { + Ok(valid) => valid, + Err(_) => {String::from("")} + }) }) .unwrap(), root_hash: parsed.4,