Export: an unknown format is an error instead of a deckcraft file

file.export with an explicit format outside png, jpeg, jpg, pdf, pptx, potx,
ppsx, deckcraft, outline and txt fell through to the native deckcraft zip, so a
request for "docx" reported success and wrote a deckcraft archive under that
name. It now returns an error and writes nothing. A format inferred from the
file extension behaves as before.
This commit is contained in:
Mikkel Georgsen
2026-10-10 22:04:58 +02:00
parent d556ff98b5
commit 20366a8ea9
2 changed files with 15 additions and 2 deletions
+3 -2
View File
@@ -264,11 +264,12 @@ fn export(s: &mut Session, p: &Value) -> Result<Value> {
write_file(&path, &bytes)?;
Ok(json!({"path": path, "bytes": bytes.len()}))
}
other => {
let bytes = save_bytes(&st.doc, other)?;
"pptx" | "potx" | "ppsx" | "deckcraft" | "outline" | "txt" => {
let bytes = save_bytes(&st.doc, &format)?;
write_file(&path, &bytes)?;
Ok(json!({"path": path, "bytes": bytes.len()}))
}
other => Err(bad("file.export", format!("unknown format `{other}`"))),
}
}