From a39409e699f1861011fcfaf9ff3ca768ac5989cc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=89=E5=92=B2=E9=9B=85=20=C2=B7=20Misaki=20Masa?= Date: Sun, 11 Aug 2024 17:30:52 +0800 Subject: [PATCH] fix: 7zip shows different error messages for RAR and ZIP files (#1468) --- Cargo.lock | 33 ++++++++++++------------- Cargo.toml | 6 ++--- yazi-boot/Cargo.toml | 2 +- yazi-cli/Cargo.toml | 2 +- yazi-core/Cargo.toml | 1 - yazi-core/src/manager/commands/hover.rs | 2 +- yazi-dds/src/state.rs | 11 +++++---- yazi-plugin/preset/plugins/archive.lua | 2 +- yazi-scheduler/Cargo.toml | 2 +- 9 files changed, 30 insertions(+), 31 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 38128795..eaac297f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -343,9 +343,9 @@ dependencies = [ [[package]] name = "cc" -version = "1.1.6" +version = "1.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2aba8f4e9906c7ce3c73463f62a7f0c65183ada1a2d47e397cc8810827f9694f" +checksum = "26a5c3fd7bfa1ce3897a3a3501d362b2d87b7f2583ebcb4a949ec25911025cbc" dependencies = [ "jobserver", "libc", @@ -381,9 +381,9 @@ dependencies = [ [[package]] name = "clap" -version = "4.5.13" +version = "4.5.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fbb260a053428790f3de475e304ff84cdbc4face759ea7a3e64c1edd938a7fc" +checksum = "11d8838454fda655dafd3accb2b6e2bea645b9e4078abe84a22ceb947235c5cc" dependencies = [ "clap_builder", "clap_derive", @@ -391,9 +391,9 @@ dependencies = [ [[package]] name = "clap_builder" -version = "4.5.13" +version = "4.5.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "64b17d7ea74e9f833c7dbf2cbe4fb12ff26783eda4782a8975b72f895c9b4d99" +checksum = "216aec2b177652e3846684cbfe25c9964d18ec45234f0f5da5157b207ed1aab6" dependencies = [ "anstream", "anstyle", @@ -403,9 +403,9 @@ dependencies = [ [[package]] name = "clap_complete" -version = "4.5.12" +version = "4.5.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a8670053e87c316345e384ca1f3eba3006fc6355ed8b8a1140d104e109e3df34" +checksum = "1d11bff0290e9a266fc9b4ce6fa96c2bf2ca3f9724c41c10202ac1daf7a087f8" dependencies = [ "clap", ] @@ -2126,9 +2126,9 @@ checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" [[package]] name = "serde" -version = "1.0.204" +version = "1.0.206" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc76f558e0cbb2a839d37354c575f1dc3fdc6546b5be373ba43d95f231bf7c12" +checksum = "5b3e4cd94123dd520a128bcd11e34d9e9e423e7e3e50425cb1b4b1e3549d0284" dependencies = [ "serde_derive", ] @@ -2145,9 +2145,9 @@ dependencies = [ [[package]] name = "serde_derive" -version = "1.0.204" +version = "1.0.206" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e0cd7e117be63d3c3678776753929474f3b04a43a080c744d6b0ae2a8c28e222" +checksum = "fabfb6138d2383ea8208cf98ccf69cdfb1aff4088460681d84189aa259762f97" dependencies = [ "proc-macro2", "quote", @@ -2156,9 +2156,9 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.122" +version = "1.0.124" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "784b6203951c57ff748476b126ccb5e8e2959a5c19e5c617ab1956be3dbc68da" +checksum = "66ad62847a56b3dba58cc891acd13884b9c61138d330c0d7b6181713d4fce38d" dependencies = [ "itoa", "memchr", @@ -2655,9 +2655,9 @@ dependencies = [ [[package]] name = "trash" -version = "5.0.0" +version = "5.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d8fbfb70b1fad5c0b788f9b2e1bf4d04e5ac6efa828f1ed9ee462c50ff9cf05" +checksum = "a154e8323dbd402514d5a3c0f12e0a5bddf72de674b565d58a5535500566428b" dependencies = [ "chrono", "libc", @@ -3292,7 +3292,6 @@ dependencies = [ "ratatui", "scopeguard", "serde", - "shell-words", "tokio", "tokio-stream", "tokio-util", diff --git a/Cargo.toml b/Cargo.toml index 6125cff0..14dd53dc 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -15,7 +15,7 @@ anyhow = "1.0.86" arc-swap = "1.7.1" base64 = "0.22.1" bitflags = "2.6.0" -clap = { version = "4.5.13", features = [ "derive" ] } +clap = { version = "4.5.15", features = [ "derive" ] } crossterm = { version = "0.27.0", features = [ "event-stream" ] } dirs = "5.0.1" futures = "0.3.30" @@ -27,8 +27,8 @@ parking_lot = "0.12.3" ratatui = "0.27.0" regex = "1.10.6" scopeguard = "1.2.0" -serde = { version = "1.0.204", features = [ "derive" ] } -serde_json = "1.0.122" +serde = { version = "1.0.206", features = [ "derive" ] } +serde_json = "1.0.124" shell-words = "1.1.0" tokio = { version = "1.39.2", features = [ "full" ] } tokio-stream = "0.1.15" diff --git a/yazi-boot/Cargo.toml b/yazi-boot/Cargo.toml index a26a8703..b2cacd3b 100644 --- a/yazi-boot/Cargo.toml +++ b/yazi-boot/Cargo.toml @@ -20,7 +20,7 @@ serde = { workspace = true } [build-dependencies] clap = { workspace = true } -clap_complete = "4.5.12" +clap_complete = "4.5.14" clap_complete_fig = "4.5.2" clap_complete_nushell = "4.5.3" vergen-gitcl = { version = "1.0.0", features = [ "build" ] } diff --git a/yazi-cli/Cargo.toml b/yazi-cli/Cargo.toml index 8ab6276a..ee93ca9e 100644 --- a/yazi-cli/Cargo.toml +++ b/yazi-cli/Cargo.toml @@ -28,7 +28,7 @@ yazi-shared = { path = "../yazi-shared", version = "0.3.0" } # External build dependencies anyhow = { workspace = true } clap = { workspace = true } -clap_complete = "4.5.12" +clap_complete = "4.5.14" clap_complete_fig = "4.5.2" clap_complete_nushell = "4.5.3" serde_json = { workspace = true } diff --git a/yazi-core/Cargo.toml b/yazi-core/Cargo.toml index 4c59e134..4ecaa680 100644 --- a/yazi-core/Cargo.toml +++ b/yazi-core/Cargo.toml @@ -30,7 +30,6 @@ parking_lot = { workspace = true } ratatui = { workspace = true } scopeguard = { workspace = true } serde = { workspace = true } -shell-words = { workspace = true } tokio = { workspace = true } tokio-stream = { workspace = true } tokio-util = { workspace = true } diff --git a/yazi-core/src/manager/commands/hover.rs b/yazi-core/src/manager/commands/hover.rs index 0fd3f9d6..262d2e48 100644 --- a/yazi-core/src/manager/commands/hover.rs +++ b/yazi-core/src/manager/commands/hover.rs @@ -28,7 +28,7 @@ impl Manager { // Hover on the file render!(self.current_or_mut(opt.tab).repos(opt.url.as_ref())); - if opt.url.zip(self.current().hovered()).is_some_and(|(u, f)| u == f.url) { + if opt.url.zip(self.current_or(opt.tab).hovered()).is_some_and(|(u, f)| u == f.url) { // `hover(Some)` occurs after user actions, such as create, rename, reveal, etc. // At this point, it's intuitive to track the location of this file regardless. self.current_or_mut(opt.tab).tracing = true; diff --git a/yazi-dds/src/state.rs b/yazi-dds/src/state.rs index ef0a4857..b0d30b35 100644 --- a/yazi-dds/src/state.rs +++ b/yazi-dds/src/state.rs @@ -69,7 +69,6 @@ impl State { state.sort_unstable_by(|(a, _), (b, _)| a.cmp(b)); for (_, v) in state { buf.write_all(v.as_bytes()).await?; - buf.write_u8(b'\n').await?; } buf.flush().await?; @@ -77,15 +76,17 @@ impl State { } async fn load(&self) -> Result<()> { - let mut buf = BufReader::new(File::open(BOOT.state_dir.join(".dds")).await?); - let mut line = String::new(); + let mut file = BufReader::new(File::open(BOOT.state_dir.join(".dds")).await?); + let mut buf = String::new(); let mut inner = HashMap::new(); - while buf.read_line(&mut line).await? > 0 { + while file.read_line(&mut buf).await? > 0 { + let line = mem::take(&mut buf); let mut parts = line.splitn(4, ','); + let Some(kind) = parts.next() else { continue }; let Some(_) = parts.next() else { continue }; - inner.insert(kind.to_owned(), mem::take(&mut line)); + inner.insert(kind.to_owned(), line); } let clients = CLIENTS.read(); diff --git a/yazi-plugin/preset/plugins/archive.lua b/yazi-plugin/preset/plugins/archive.lua index d10c0e2f..25a84209 100644 --- a/yazi-plugin/preset/plugins/archive.lua +++ b/yazi-plugin/preset/plugins/archive.lua @@ -137,6 +137,6 @@ function M:list_files(args, skip, limit) return files, i, code end -function M:is_encrypted(s) return s:find(". Wrong password?", 1, true) end +function M:is_encrypted(s) return s:find(" Wrong password", 1, true) end return M diff --git a/yazi-scheduler/Cargo.toml b/yazi-scheduler/Cargo.toml index d59d6701..814f12b3 100644 --- a/yazi-scheduler/Cargo.toml +++ b/yazi-scheduler/Cargo.toml @@ -28,4 +28,4 @@ tracing = { workspace = true } libc = { workspace = true } [target.'cfg(not(target_os = "android"))'.dependencies] -trash = "5.0.0" +trash = "5.1.0"