#1314: refuse saving over the file only when save_to has a path (main's download has none)

This commit is contained in:
bflatastic
2026-10-26 09:12:21 +07:00
parent 1ec74401e6
commit df8edc6b8c
+4 -1
View File
@@ -900,7 +900,10 @@ fn save_to(s: &mut Session, path: Option<String>) -> Result<Value> {
}
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()