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:
Mex authored and GitHub committed 2026-11-15 20:26:14 +01:00
1 parent bc0e51ee4d
commit a9a1aa36a2
1 file changed
+1 -1
+1 -1
View File
@@ -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())