fix: user-prepended open rules do not override presets

This commit is contained in:
sxyazi 2025-11-24 11:45:57 +08:00
parent e5ee31cb7e
commit 765cc0dce5
No known key found for this signature in database
2 changed files with 4 additions and 1 deletions

View file

@ -60,6 +60,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/):
### Fixed ### Fixed
- User-prepended open rules do not override presets ([#3360])
- Respect user's system media opener instead of hardcoding `mpv` ([#2959]) - Respect user's system media opener instead of hardcoding `mpv` ([#2959])
- Incorrect `$0` and `$@` parameters in `shell` command under empty directories ([#3225]) - Incorrect `$0` and `$@` parameters in `shell` command under empty directories ([#3225])
- Avoid appending a newline when reading clipboard contents ([#3059]) - 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 [#3290]: https://github.com/sxyazi/yazi/pull/3290
[#3313]: https://github.com/sxyazi/yazi/pull/3313 [#3313]: https://github.com/sxyazi/yazi/pull/3313
[#3317]: https://github.com/sxyazi/yazi/pull/3317 [#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 self
.rules .rules
.iter() .iter()
.filter(move |&r| { .find(move |&r| {
r.mime.as_ref().is_some_and(|p| p.match_mime(&mime)) 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)) || r.url.as_ref().is_some_and(|p| p.match_url(url.as_url(), is_dir))
}) })
.into_iter()
.flat_map(|r| &r.r#use) .flat_map(|r| &r.r#use)
.map(String::as_str) .map(String::as_str)
} }