Skip to content

Commit 76fe6d7

Browse files
committed
fix: user-prepended open rules do not override presets (#3360)
1 parent e5ee31c commit 76fe6d7

File tree

3 files changed

+5
-3
lines changed

3 files changed

+5
-3
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/):
6060

6161
### Fixed
6262

63+
- User-prepended open rules do not override presets ([#3360])
6364
- Respect user's system media opener instead of hardcoding `mpv` ([#2959])
6465
- Incorrect `$0` and `$@` parameters in `shell` command under empty directories ([#3225])
6566
- 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/):
15371538
[#3290]: https://github.com/sxyazi/yazi/pull/3290
15381539
[#3313]: https://github.com/sxyazi/yazi/pull/3313
15391540
[#3317]: https://github.com/sxyazi/yazi/pull/3317
1541+
[#3360]: https://github.com/sxyazi/yazi/pull/3360

yazi-config/src/open/open.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,11 @@ impl Open {
3434
self
3535
.rules
3636
.iter()
37-
.filter(move |&r| {
37+
.find(move |&r| {
3838
r.mime.as_ref().is_some_and(|p| p.match_mime(&mime))
3939
|| r.url.as_ref().is_some_and(|p| p.match_url(url.as_url(), is_dir))
4040
})
41+
.into_iter()
4142
.flat_map(|r| &r.r#use)
4243
.map(String::as_str)
4344
}

yazi-scheduler/src/process/shell.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,8 @@ pub(crate) async fn shell(opt: ShellOpt) -> Result<Child> {
4040
.stderr(opt.stdio())
4141
.arg("-c")
4242
.arg(opt.cmd)
43-
// .arg("--")
4443
// TODO: remove
45-
.args(opt.args.iter().skip(1).map(|u| u.as_url().unified_path_str()))
44+
.args(opt.args.iter().map(|u| u.as_url().unified_path_str()))
4645
.current_dir(cwd)
4746
.kill_on_drop(!opt.orphan)
4847
.pre_exec(move || {

0 commit comments

Comments
 (0)