Add "trim(always)" to CSV decoder. Whitespace between comma

separated items will no longer cause validation issues - excess
whitespace is automatically trimmed at the beginning and end
of comma separated entries before parsing.

First part of ISSUE #240
(Fixing the validation issue rather than the actual cause)
This commit is contained in:
Herbert Wolverson
2023-02-02 14:26:57 +00:00
parent 27debaf0f1
commit 2926fa5c7a

View File

@@ -53,7 +53,7 @@ impl ConfigShapedDevices {
pub fn load() -> Result<Self, ShapedDevicesError> {
let final_path = ConfigShapedDevices::path()?;
let reader =
ReaderBuilder::new().comment(Some(b'#')).from_path(final_path);
ReaderBuilder::new().comment(Some(b'#')).trim(csv::Trim::All).from_path(final_path);
if reader.is_err() {
error!("Unable to read ShapedDevices.csv");
return Err(ShapedDevicesError::OpenFail);