mirror of
https://github.com/storytold/figcraft.git
synced 2026-11-06 02:21:55 +00:00
#1314: refuse saving over the file only when save_to has a path (main's download has none)
This commit is contained in:
1 parent
1ec74401e6
commit
df8edc6b8c
1 file changed
+4
-1
@@ -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()
|
||||
|
||||
Reference in new issue
Block a user