Skip to content

A fast file manager for Windows and macOS that never freezes: tabs, dual panes, archives as folders, Quick Look-style previews. A File Explorer and Finder alternative written in Rust.

A locked archive's password is asked in a main window, not the closing menu

gelenmedya792acfe5c8dc
diff --git a/crates/rf-app/src/status_center.rs b/crates/rf-app/src/status_center.rs
index a7a3961b..a9288e6d 100644
--- a/crates/rf-app/src/status_center.rs
+++ b/crates/rf-app/src/status_center.rs
@@ -1340,7 +1340,12 @@ pub fn extract_pick(cx: &mut App, archives: Vec<std::path::PathBuf>) {
/// Asks for the password of the last archive of `rest`, starts it, and goes on with the others.
fn ask_then_extract(cx: &mut App, mut rest: Vec<std::path::PathBuf>, to: ExtractTo) {
let Some(archive) = rest.pop() else { return };
- if let Some(w) = cx.active_window() {
+ // The question goes to a main window. The window in front can be the right-click menu's own, which is closing: the prompt was
+ // drawn there and went with it, so no password was asked and nothing was extracted (Discord, 2026-12-02: "When a ZIP archive is
+ // password-protected, extraction just never happens").
+ let main = crate::workspace::main_windows(cx);
+ let front = cx.active_window().filter(|a| main.iter().any(|m| m.window_id() == a.window_id())).or_else(|| main.first().copied());
+ if let Some(w) = front {
let (a, t, r) = (archive.clone(), to.clone(), rest.clone());
let asked = w
.update(cx, |_, window, cx| {
diff --git a/crates/rf-archive/examples/locked_zip.rs b/crates/rf-archive/examples/locked_zip.rs
new file mode 100644
index 00000000..be27b25b
--- /dev/null
+++ b/crates/rf-archive/examples/locked_zip.rs
@@ -0,0 +1,11 @@
+//! Makes a password-protected zip for trying the extraction prompt: `locked_zip <out.zip> <password> <file or folder>...`.
+fn main() -> anyhow::Result<()> {
+ let mut args = std::env::args().skip(1);
+ let out = std::path::PathBuf::from(args.next().expect("out.zip"));
+ let password = args.next().expect("password");
+ let sources: Vec<std::path::PathBuf> = args.map(std::path::PathBuf::from).collect();
+ let opts = rf_archive::CompressOptions { password: Some(password), ..Default::default() };
+ rf_archive::compress_with(&sources, &out, rf_archive::Format::Zip, 5, &opts, &mut |_| {}, &|| false)?;
+ println!("made {}", out.display());
+ Ok(())
+}