From df8edc6b8ce8c39b00d5a27424ca5bca9360795d Mon Sep 17 00:00:00 2001 From: bflatastic Date: Mon, 26 Oct 2026 09:12:21 +0700 Subject: [PATCH] #1314: refuse saving over the file only when save_to has a path (main's download has none) --- crates/engine/src/cmd/file.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/crates/engine/src/cmd/file.rs b/crates/engine/src/cmd/file.rs index 039a33ba..d75ede3e 100644 --- a/crates/engine/src/cmd/file.rs +++ b/crates/engine/src/cmd/file.rs @@ -900,7 +900,10 @@ fn save_to(s: &mut Session, path: Option) -> Result { } let i = crate::branches::file_tab(s); let ds = s.docs.get_mut(i).ok_or(EngineError::NoDocument)?; - refuse_dropping_images(ds, &path)?; + // A download (no path) writes over no file. + if let Some(path) = path.as_deref() { + refuse_dropping_images(ds, path)?; + } let mut snapshot = FileSnapshot::of(ds); let follows_path = ds.path.as_deref().map_or(ds.doc.name == "Untitled", |old| ds.doc.name == file_stem(old)); if let Some(path) = path.as_deref()