Skip to content

Commit

Permalink
[2 of 2]: filter::parse_spec() ignore bogon empty, blank substrings
Browse files Browse the repository at this point in the history
Fix issue demonstrated by unit tests in commit 2ff2bf1.

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.
  • Loading branch information
salewski committed Dec 4, 2020
1 parent 2ff2bf1 commit 954267a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/filter/mod.rs
Expand Up @@ -299,7 +299,7 @@ fn parse_spec(spec: &str) -> (Vec<Directive>, Option<inner::Filter>) {
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;
}
Expand Down

0 comments on commit 954267a

Please sign in to comment.