fix: user-prepended open rules do not override presets (#3360)

This commit is contained in:
sxyazi 2025-11-24 12:30:52 +08:00
parent e5ee31cb7e
commit 76fe6d7244
No known key found for this signature in database
3 changed files with 5 additions and 3 deletions

View file

@ -60,6 +60,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/):
### Fixed
- User-prepended open rules do not override presets ([#3360])
- Respect user's system media opener instead of hardcoding `mpv` ([#2959])
- Incorrect `$0` and `$@` parameters in `shell` command under empty directories ([#3225])
- Avoid appending a newline when reading clipboard contents ([#3059])
@ -1537,3 +1538,4 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/):
[#3290]: https://github.com/sxyazi/yazi/pull/3290
[#3313]: https://github.com/sxyazi/yazi/pull/3313
[#3317]: https://github.com/sxyazi/yazi/pull/3317
[#3360]: https://github.com/sxyazi/yazi/pull/3360

View file

@ -34,10 +34,11 @@ impl Open {
self
.rules
.iter()
.filter(move |&r| {
.find(move |&r| {
r.mime.as_ref().is_some_and(|p| p.match_mime(&mime))
|| r.url.as_ref().is_some_and(|p| p.match_url(url.as_url(), is_dir))
})
.into_iter()
.flat_map(|r| &r.r#use)
.map(String::as_str)
}

View file

@ -40,9 +40,8 @@ pub(crate) async fn shell(opt: ShellOpt) -> Result<Child> {
.stderr(opt.stdio())
.arg("-c")
.arg(opt.cmd)
// .arg("--")
// TODO: remove
.args(opt.args.iter().skip(1).map(|u| u.as_url().unified_path_str()))
.args(opt.args.iter().map(|u| u.as_url().unified_path_str()))
.current_dir(cwd)
.kill_on_drop(!opt.orphan)
.pre_exec(move || {