diff --git a/aider/coders/udiff_coder.py b/aider/coders/udiff_coder.py index 05583a08d..189aea3e5 100644 --- a/aider/coders/udiff_coder.py +++ b/aider/coders/udiff_coder.py @@ -334,11 +334,9 @@ def process_fenced_block(lines, start_line_num): block = lines[start_line_num:line_num] block.append("@@ @@") - if block[1].startswith("--- ") and block[2].startswith("+++ "): + if block[0].startswith("--- ") and block[1].startswith("+++ "): # Extract the file path, considering that it might contain spaces fname = block[1][4:].strip() - # Ensure that the file path is the same for both the original and new file - assert fname == block[2][4:].strip(), "File paths in diff headers do not match" block = block[2:] else: fname = None