mirror of
https://github.com/storytold/wordcraft.git
synced 2026-11-18 00:15:44 +00:00
M14: preserve existing PDF suffixes in web exports
Recognize an existing PDF extension without changing its case or the requested filename.
This commit is contained in:
1 file changed
+1
-1
@@ -145,7 +145,7 @@ impl WordApp {
|
||||
// Web: saving and exporting become downloads.
|
||||
if self.services.download.is_some() && matches!(id, "file.save" | "file.saveAs" | "file.exportPdf" | "file.exportPng") {
|
||||
let name = params.get("path").and_then(Value::as_str).map(str::to_string).unwrap_or_else(|| self.web_save_name(id));
|
||||
let name = if id == "file.exportPdf" && !name.ends_with(".pdf") { format!("{name}.pdf") } else { name };
|
||||
let name = if id == "file.exportPdf" && !name.to_ascii_lowercase().ends_with(".pdf") { format!("{name}.pdf") } else { name };
|
||||
// A save with a password encrypts this and later saves (`file.save`'s `password`).
|
||||
if matches!(id, "file.save" | "file.saveAs")
|
||||
&& let Some(pw) = params.get("password").filter(|v| !v.is_null())
|
||||
|
||||
Reference in new issue
Block a user