Fix save converted files (#5971)

Fix saving converted files on tauri
This commit is contained in:
Reece Browne
2026-03-23 13:51:40 +00:00
committed by GitHub
parent e5f6180dbe
commit 41945543e0

View File

@@ -38,12 +38,14 @@ export async function showSaveDialog(
try {
const { save } = await import("@tauri-apps/plugin-dialog");
// Derive the file type filter from the filename extension so the dialog
// doesn't force a .pdf extension when saving non-PDF outputs (e.g. .docx).
const ext = defaultFilename.split('.').pop()?.toLowerCase() ?? '';
const filters = ext ? [{ name: ext.toUpperCase(), extensions: [ext] }] : [];
const selectedPath = await save({
defaultPath: defaultDirectory ? `${defaultDirectory}/${defaultFilename}` : defaultFilename,
filters: [{
name: 'PDF',
extensions: ['pdf']
}],
filters,
title: 'Save As'
});