From b81b707a3ea767e04fb02fddfc3a093e7769229e Mon Sep 17 00:00:00 2001 From: sxyazi Date: Mon, 27 May 2024 21:36:15 +0800 Subject: [PATCH] fix: `match_mime()` should return true if pattern is "*" --- yazi-config/src/pattern.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/yazi-config/src/pattern.rs b/yazi-config/src/pattern.rs index 772a5866..d92c6ee6 100644 --- a/yazi-config/src/pattern.rs +++ b/yazi-config/src/pattern.rs @@ -13,7 +13,9 @@ pub struct Pattern { impl Pattern { #[inline] - pub fn match_mime(&self, str: impl AsRef) -> bool { self.inner.is_match(str.as_ref()) } + pub fn match_mime(&self, str: impl AsRef) -> bool { + self.is_star || self.inner.is_match(str.as_ref()) + } #[inline] pub fn match_path(&self, path: impl AsRef, is_dir: bool) -> bool { @@ -36,7 +38,7 @@ impl TryFrom<&str> for Pattern { let inner = GlobBuilder::new(b) .case_insensitive(a.len() == s.len()) - .literal_separator(true) + .literal_separator(false) .backslash_escape(false) .empty_alternates(true) .build()?