Skip to content

fix(media): keep dotted input stems intact in folder output names - #568

Open
kevin9327 wants to merge 1 commit into
Kruk2:mainfrom
kevin9327:fix/output-pattern-dotted-stem
Open

kevin9327 wants to merge 1 commit into
Kruk2:mainfrom
kevin9327:fix/output-pattern-dotted-stem

Conversation

@kevin9327

Copy link
Copy Markdown

folder_output_path decided whether the output pattern had an extension by looking at the substituted name. If the input stem contains a dot, that stem looks like an extension:

  • clip.v2.mkv with pattern {original}_restored gave clip.v2_restored, with no .mkv. Its "suffix" is .v2_restored, so the input extension was never added and the encoder got a path with no real container extension.
  • a.b.png with pattern {original}_restored gave a.png. with_suffix replaced .b_restored, so the pattern text was lost, and a.b.png and a.c.png both mapped to the same output.

This affects the CLI folder mode, image restore, and the GUI queue/processor, which all call this helper.

Fix: take the extension from the pattern itself (with {original} removed) rather than from the result. Patterns with and without an extension behave as before for undotted names.

Tests: I added three cases to TestFolderOutputPath in tests/test_media_files.py. The two dotted-stem cases fail on main and pass with the fix, and all 14 tests in the file pass.

AI-assistance note: I found and wrote this change with help from an AI coding assistant. I reviewed it and ran the tests myself.

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