Skip to content

fix(subtitle): preserve literal backslashes in correction values - #718

Merged
calesthio merged 1 commit into
OpenMontageInc:mainfrom
ac1982:fix/subtitle-literal-corrections
Nov 8, 2026
Merged

calesthio merged 1 commit into
OpenMontageInc:mainfrom
ac1982:fix/subtitle-literal-corrections

Conversation

@ac1982

@ac1982 ac1982 commented Oct 7, 2026

Copy link
Copy Markdown
Contributor

Segment-level subtitle corrections pass replacement strings directly to re.sub. A literal correction such as C:\Users\speaker raises re.PatternError, \1 is treated as a nonexistent capture group, and line\ntext silently becomes two lines. Word-level corrections already preserve the same values literally.

Return the replacement from a callback so segment-level corrections preserve literal text too. Add three end-to-end SRT-generation regressions and a consistency test for segment/word corrections; all four fail before the fix.

Validation: 8 subtitle correction/timestamp tests pass. Tests write only temporary subtitle files; no provider calls. Searched existing subtitle/corrections/escape issues and PRs, including #538 (CJK spacing).

@calesthio calesthio left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thank you for fixing literal correction replacements. Reviewed the complete diff against main 63d1087a: the replacement callback preserves literal backslashes and group-like text without mutating input segments. Validation: isolated offline correction/timestamp suites — 8 passed.

@calesthio calesthio closed this Nov 7, 2026
@calesthio calesthio reopened this Nov 7, 2026
calesthio pushed a commit that referenced this pull request Nov 8, 2026
@calesthio
calesthio merged commit 3e21798 into OpenMontageInc:main Nov 8, 2026
1 check 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.

2 participants