diff --git a/src/components/pdf-processor/ProcessingOptions.tsx b/src/components/pdf-processor/ProcessingOptions.tsx index d49ec74..cb47be8 100644 --- a/src/components/pdf-processor/ProcessingOptions.tsx +++ b/src/components/pdf-processor/ProcessingOptions.tsx @@ -196,8 +196,7 @@ export default function ProcessingOptions({ mode, options, onOptionsChangeAction [field]: value, }; const cleanedEntries = Object.entries(nextMeta) - .map(([key, val]) => [key, typeof val === 'string' ? val.trim() : ''] as const) - .filter(([, val]) => val.length > 0); + .filter(([, val]) => typeof val === 'string' && val.length > 0); onOptionsChangeAction({ ...options, diff --git a/src/components/pdf-processor/index.tsx b/src/components/pdf-processor/index.tsx index b978201..b938063 100644 --- a/src/components/pdf-processor/index.tsx +++ b/src/components/pdf-processor/index.tsx @@ -294,9 +294,11 @@ export default function PDFProcessor({ initialMode = 'merge' }: { initialMode?: if (operation === 'merge' && processingOptions.metadata?.title) { const customTitle = processingOptions.metadata.title.trim(); if (customTitle) { - // Sanitize the custom title to be safe for filenames - const sanitizedTitle = customTitle.replace(/[^a-zA-Z0-9-_ ]/g, '').replace(/\s+/g, '_'); - return ensurePdfExtension(`${sanitizedTitle}_pdflince`); + // Sanitize the custom title to be safe for filenames but preserve spaces, accents, &, and () + const sanitizedTitle = customTitle.replace(/[^\p{L}\p{N}\-_ &()]/gu, '').trim(); + if (sanitizedTitle) { + return ensurePdfExtension(sanitizedTitle); + } } }