From 954267a7ca0d45de68f694d2b3cb57410042edd9 Mon Sep 17 00:00:00 2001 From: "Alan D. Salewski" Date: Fri, 4 Dec 2020 18:35:27 -0500 Subject: [PATCH] [2 of 2]: filter::parse_spec() ignore bogon empty, blank substrings Fix issue demonstrated by unit tests in commit 2ff2bf160e8d. While parsing comma-separated substrings, parse_spec() now trims the values to ensure empty and blank substrings (which are invalid) are ignored. Previously, only-comma-separated empty substrings were being ignored. This change extends that intent to also ignore the empty string (no comma), stand-alone blank strings (no comma), and comma- separated variations of empty and/or blank substrings. --- src/filter/mod.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/filter/mod.rs b/src/filter/mod.rs index 495b85ca..728e4d52 100644 --- a/src/filter/mod.rs +++ b/src/filter/mod.rs @@ -299,7 +299,7 @@ fn parse_spec(spec: &str) -> (Vec, Option) { return (dirs, None); } if let Some(m) = mods { - for s in m.split(',') { + for s in m.split(',').map(|ss| ss.trim()) { if s.is_empty() { continue; }