From 075f2663dacd0813d87a2d80938f700a0bd09653 Mon Sep 17 00:00:00 2001 From: Douglas Yau Date: Mon, 15 Jan 2024 11:24:16 -0600 Subject: [PATCH 1/2] Trim \0 characters from photometric interpretation --- pixeldata/src/attribute.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/pixeldata/src/attribute.rs b/pixeldata/src/attribute.rs index a04622542..a64c3d91f 100644 --- a/pixeldata/src/attribute.rs +++ b/pixeldata/src/attribute.rs @@ -492,6 +492,7 @@ pub fn photometric_interpretation( .string() .context(CastValueSnafu { name })? .trim() + .trim_matches(char::from(0)) .into()) } From 87bfa08a5bfa34e99d48541f4016516668677de3 Mon Sep 17 00:00:00 2001 From: Douglas Yau Date: Tue, 16 Jan 2024 14:59:49 -0600 Subject: [PATCH 2/2] Update pixeldata/src/attribute.rs Trim the whitestpaces and null characters in 1 go Co-authored-by: Eduardo Pinho --- pixeldata/src/attribute.rs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/pixeldata/src/attribute.rs b/pixeldata/src/attribute.rs index a64c3d91f..e1ed3025b 100644 --- a/pixeldata/src/attribute.rs +++ b/pixeldata/src/attribute.rs @@ -491,8 +491,7 @@ pub fn photometric_interpretation( .context(MissingRequiredSnafu { name })? .string() .context(CastValueSnafu { name })? - .trim() - .trim_matches(char::from(0)) + .trim_matches(|c: char| c.is_whitespace() || c == '\0') .into()) }