You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fixes#4851: Prevent apply_diff tool hangs when modifying XML files
- Added timeout protection to XML parsing in multiApplyDiffTool to prevent hangs on complex XML content
- Implemented safer HTML entity unescaping for XML files to avoid corruption
- Added timeout mechanisms to regex operations in diff strategies to prevent infinite loops
- Enhanced error messages with specific guidance for XML file modifications
- Improved detection of problematic XML content patterns
The fix addresses the root causes:
1. XML parsing timeouts that could hang indefinitely
2. Double-escaping/unescaping issues with XML entities
3. Complex regex patterns hanging on large XML content
4. Lack of proper error handling for XML-specific edge cases
Copy file name to clipboardExpand all lines: src/core/diff/strategies/multi-file-search-replace.ts
+33-5Lines changed: 33 additions & 5 deletions
Original file line number
Diff line number
Diff line change
@@ -463,11 +463,39 @@ Each file requires its own path, start_line, and diff elements.
463
463
8. ([\s\S]*?)(?:\n)? Non‐greedy match for the "replace content" (group 7).
464
464
9. (?:(?<=\n)(?<!\\)>>>>>>> REPLACE)(?=\n|$) Matches the final ">>>>>>> REPLACE" marker on its own line (and requires a following newline or the end of file).
error: `Failed to parse diff content: ${errorMessage}\n\nThis often happens with complex XML content. Try:\n1. Breaking down large changes into smaller diffs\n2. Simplifying the diff content\n3. Using write_to_file for extensive changes`,
error: `Failed to parse diff content: ${errorMessage}\n\nThis often happens with complex XML content. Try:\n1. Breaking down large changes into smaller diffs\n2. Simplifying the diff content\n3. Using write_to_file for extensive changes`,
0 commit comments