Skip to content

Conversation

knguyen1
Copy link
Contributor

@knguyen1 knguyen1 commented Aug 14, 2025

Summary

  • This is a…
    • Bug fix
    • Feature addition
    • Refactoring
    • Minor / simple change (like a typo)
    • Other
  • Describe this change in 1-2 sentences:
    • Allow up to 3-character replacements (including whitespace) for Windows-illegal characters in the Windows compatibility dialog; relax validation accordingly. Adds unit tests for old vs. new behavior.

Problem

  • One-for-one replacement and whitespace prohibition limited filename rewriting flexibility (e.g., wanting “: ” → “ - ”).
  • UI QLineEdit fields were restricted to length 1, and the validator rejected spaces.

Solution

  • UI: Increase maxLength to 3 for all replacement fields in ui/win_compat_dialog.ui and adjust field width for visibility.
  • Validation: Update WinCompatReplacementValidator in picard/ui/options/renaming_compat.py to allow multi-character strings and whitespace while still forbidding Windows-illegal characters and directory separators.
  • Tests: Add test/test_win_compat_replacement_validator.py:
    • Encodes BEFORE behavior in an in-test OldValidator.
    • Verifies all previously accepted inputs remain accepted.
    • Confirms illegal characters are still rejected.
    • Ensures multi-character and whitespace-only inputs are now accepted.
    • Confirms directory separators remain rejected.
    • Checks validator returns the original (text, pos).

Notes:

Action

Additional actions required:

  • Update Picard documentation (picard-docs) to note that Windows-illegal character replacements now accept up to 3 characters (including spaces), and clarify per-character mapping behavior.
  • Other (please specify below)

@zas zas requested review from phw and zas and removed request for phw August 15, 2025 09:09
Copy link
Collaborator

@zas zas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Member

@phw phw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for finishing this up

@phw phw merged commit 9044d03 into metabrainz:master Aug 15, 2025
45 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.

3 participants