Skip to content

fix(patch): use regex to detect line-number prefix to prevent pipe char corruption#970

Open
alireza78a wants to merge 1 commit intoNousResearch:mainfrom
alireza78a:fix/patch-pipe-char-corruption
Open

fix(patch): use regex to detect line-number prefix to prevent pipe char corruption#970
alireza78a wants to merge 1 commit intoNousResearch:mainfrom
alireza78a:fix/patch-pipe-char-corruption

Conversation

@alireza78a
Copy link
Contributor

What
V4A patch apply uses if '|' in line to strip line-number prefixes from
file content. Any line containing | — Python bitwise ops, shell pipes,
SQL, Markdown tables — is split on the first | and the left side is
dropped. The file is rewritten with those lines corrupted, no error reported.

How It Works
Replaced the '|' in line check with re.match(r'^\s*\d+\|', line).
This matches only the actual line-number prefix format ( 123|content)
and leaves all other | characters untouched.

Tests
154 patch-related tests pass.

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