Skip to content

Commit 573ca52

Browse files
authored
feat: add ext() method to Url userdata (#1528)
1 parent 46f42b2 commit 573ca52

File tree

13 files changed

+76
-64
lines changed

13 files changed

+76
-64
lines changed

Cargo.lock

Lines changed: 45 additions & 38 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ crossterm = { version = "0.27.0", features = [ "event-stream" ] }
2020
dirs = "5.0.1"
2121
futures = "0.3.30"
2222
globset = "0.4.14"
23-
libc = "0.2.156"
23+
libc = "0.2.158"
2424
md-5 = "0.10.6"
2525
mlua = { version = "0.9.9", features = [ "lua54", "serialize", "macros", "async" ] }
2626
parking_lot = "0.12.3"
@@ -30,7 +30,7 @@ scopeguard = "1.2.0"
3030
serde = { version = "1.0.208", features = [ "derive" ] }
3131
serde_json = "1.0.125"
3232
shell-words = "1.1.0"
33-
tokio = { version = "1.39.2", features = [ "full" ] }
33+
tokio = { version = "1.39.3", features = [ "full" ] }
3434
tokio-stream = "0.1.15"
3535
tokio-util = "0.7.11"
3636
tracing = { version = "0.1.40", features = [ "max_level_debug", "release_max_level_warn" ] }

yazi-boot/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ serde = { workspace = true }
2020

2121
[build-dependencies]
2222
clap = { workspace = true }
23-
clap_complete = "4.5.16"
23+
clap_complete = "4.5.19"
2424
clap_complete_fig = "4.5.2"
2525
clap_complete_nushell = "4.5.3"
2626
vergen-gitcl = { version = "1.0.0", features = [ "build" ] }

yazi-cli/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ yazi-shared = { path = "../yazi-shared", version = "0.3.1" }
2828
# External build dependencies
2929
anyhow = { workspace = true }
3030
clap = { workspace = true }
31-
clap_complete = "4.5.16"
31+
clap_complete = "4.5.19"
3232
clap_complete_fig = "4.5.2"
3333
clap_complete_nushell = "4.5.3"
3434
serde_json = { workspace = true }

yazi-config/src/pattern.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ pub struct Pattern {
1313

1414
impl Pattern {
1515
#[inline]
16-
pub fn match_mime(&self, str: impl AsRef<str>) -> bool {
17-
self.is_star || self.inner.is_match(str.as_ref())
16+
pub fn match_mime(&self, mime: impl AsRef<str>) -> bool {
17+
self.is_star || (!mime.as_ref().is_empty() && self.inner.is_match(mime.as_ref()))
1818
}
1919

2020
#[inline]

yazi-config/src/plugin/fetcher.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,10 @@ pub struct Fetcher {
2222

2323
impl Fetcher {
2424
#[inline]
25-
pub fn matches(&self, path: &Path, mime: Option<&str>, f: impl Fn(&str) -> bool + Copy) -> bool {
25+
pub fn matches(&self, path: &Path, mime: &str, f: impl Fn(&str) -> bool + Copy) -> bool {
2626
self.if_.as_ref().and_then(|c| c.eval(f)) != Some(false)
27-
&& (self.mime.as_ref().zip(mime).map_or(false, |(p, m)| p.match_mime(m))
28-
|| self.name.as_ref().is_some_and(|p| p.match_path(path, mime == Some(MIME_DIR))))
27+
&& (self.mime.as_ref().is_some_and(|p| p.match_mime(mime))
28+
|| self.name.as_ref().is_some_and(|p| p.match_path(path, mime == MIME_DIR)))
2929
}
3030
}
3131

yazi-config/src/plugin/plugin.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ impl Plugin {
1616
pub fn fetchers<'a>(
1717
&'a self,
1818
path: &'a Path,
19-
mime: Option<&'a str>,
19+
mime: &'a str,
2020
factor: impl Fn(&str) -> bool + Copy,
2121
) -> impl Iterator<Item = &'a Fetcher> {
2222
let mut seen = HashSet::new();
@@ -32,7 +32,7 @@ impl Plugin {
3232
pub fn preloaders<'a>(
3333
&'a self,
3434
path: &'a Path,
35-
mime: Option<&'a str>,
35+
mime: &'a str,
3636
) -> impl Iterator<Item = &'a Preloader> {
3737
let mut next = true;
3838
self.preloaders.iter().filter(move |&p| {

0 commit comments

Comments
 (0)