fix(patch): use regex to detect line-number prefix to avoid corrupting pipe chars
This commit is contained in:
parent
0bb7ed1d95
commit
1182aeea00
1 changed files with 1 additions and 1 deletions
|
|
@ -359,7 +359,7 @@ def _apply_update(op: PatchOperation, file_ops: Any) -> Tuple[bool, str]:
|
||||||
# Parse content (remove line numbers)
|
# Parse content (remove line numbers)
|
||||||
current_lines = []
|
current_lines = []
|
||||||
for line in read_result.content.split('\n'):
|
for line in read_result.content.split('\n'):
|
||||||
if '|' in line:
|
if re.match(r'^\s*\d+\|', line):
|
||||||
# Line format: " 123|content"
|
# Line format: " 123|content"
|
||||||
parts = line.split('|', 1)
|
parts = line.split('|', 1)
|
||||||
if len(parts) == 2:
|
if len(parts) == 2:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue