From 6ad513cc1b33900c347f96935ca12386fab6b12e Mon Sep 17 00:00:00 2001 From: Harsh Shandilya Date: Sun, 24 Dec 2023 00:47:26 +0530 Subject: [PATCH] fix(config): skip empty patterns in `file_filter` My NixOS module inserts these and I'm too lazy to fix this in Nix --- src/config.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/config.rs b/src/config.rs index c9cfe57..e0c17c7 100644 --- a/src/config.rs +++ b/src/config.rs @@ -21,8 +21,10 @@ pub struct Bucket<'bucket> { impl<'a> Root<'a> { pub fn is_match(&self, file_name: &str) -> bool { if let Some(pattern) = self.bucket.file_filter { - if let Ok(glob) = Glob::new(pattern) { - return glob.compile_matcher().is_match(file_name); + if !pattern.is_empty() { + if let Ok(glob) = Glob::new(pattern) { + return glob.compile_matcher().is_match(file_name); + } } }; true