Skip to content

Fix filename spaces#3

Merged
GSiesto merged 2 commits intomainfrom
fix-filename-spaces
Mar 4, 2026
Merged

Fix filename spaces#3
GSiesto merged 2 commits intomainfrom
fix-filename-spaces

Conversation

@GSiesto
Copy link
Owner

@GSiesto GSiesto commented Mar 4, 2026

Description

This PR fixes an issue where users were unable to include spaces in custom filenames when using the Merge PDF tool.

Previously, an aggressive .trim() functioned on every keystroke, immediately deleting any trailing spaces the user typed. Additionally, the filename generation logic was overly restrictive, stripping out safe characters (like &, (, ), and accented letters) and replacing intentional spaces with underscores during the download process.

Changes made:

  • Updated ProcessingOptions.tsx to remove the aggressive .trim() on the metadata.title input field, allowing users to type spaces naturally.
  • Updated buildFileName in index.tsx to use a more permissive regex (/[^\p{L}\p{N}\-_ &()]/gu) that preserves spaces, unicode letters (like ñ or accents), ampersands, and parentheses in the final downloaded filename.
  • Removed the automatic appending of the _pdflince generic suffix when a user explicitly provides a custom title.

Fixes # (issue)

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update

How Has This Been Tested?

The changes were tested manually in the browser and verified against the existing automated browser test suite.

  • Manual UI Testing: Verified that typing "Document A y B & C (Final)" in the "Merged document title" input field works perfectly without aggressively deleting spaces.
  • Manual Download Testing: Merged two PDFs and verified the downloaded file is correctly named exactly as typed (e.g., "Document A y B & C (Final).pdf"), instead of "Document_A_y_B___C__Final__pdflince.pdf".
  • E2E Test Suite (npm run test:e2e): Verified that the PDF Merge Workflow tests still pass successfully and that the changes do not break other existing processing tools. (Note: minor local fixture errors in smoke.spec.ts are unrelated to this PR).

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes

Thanks Sara for finding the bug :)

@GSiesto GSiesto merged commit b0aa7b5 into main Mar 4, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant