mirror of
https://github.com/sxyazi/yazi.git
synced 2025-01-07 00:47:22 +03:00
fix: match_mime()
should return true if pattern is "*"
This commit is contained in:
parent
4c46862506
commit
b81b707a3e
@ -13,7 +13,9 @@ pub struct Pattern {
|
|||||||
|
|
||||||
impl Pattern {
|
impl Pattern {
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn match_mime(&self, str: impl AsRef<str>) -> bool { self.inner.is_match(str.as_ref()) }
|
pub fn match_mime(&self, str: impl AsRef<str>) -> bool {
|
||||||
|
self.is_star || self.inner.is_match(str.as_ref())
|
||||||
|
}
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn match_path(&self, path: impl AsRef<Path>, is_dir: bool) -> bool {
|
pub fn match_path(&self, path: impl AsRef<Path>, is_dir: bool) -> bool {
|
||||||
@ -36,7 +38,7 @@ impl TryFrom<&str> for Pattern {
|
|||||||
|
|
||||||
let inner = GlobBuilder::new(b)
|
let inner = GlobBuilder::new(b)
|
||||||
.case_insensitive(a.len() == s.len())
|
.case_insensitive(a.len() == s.len())
|
||||||
.literal_separator(true)
|
.literal_separator(false)
|
||||||
.backslash_escape(false)
|
.backslash_escape(false)
|
||||||
.empty_alternates(true)
|
.empty_alternates(true)
|
||||||
.build()?
|
.build()?
|
||||||
|
Loading…
Reference in New Issue
Block a user