Skip to content

Commit dd1c12d

Browse files
author
Yoshihiro Takahara
committed
fix: Return None instead of current content on error in edit_file_contents
1 parent 79a4850 commit dd1c12d

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/mcp_text_editor/text_editor.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,7 @@ async def edit_file_contents(
265265
"result": "error",
266266
"reason": "Hash mismatch - file has been modified",
267267
"file_hash": None,
268-
"content": current_content,
268+
"content": None,
269269
}
270270
else:
271271
lines = current_content.splitlines(keepends=True)
@@ -299,7 +299,7 @@ async def edit_file_contents(
299299
"result": "error",
300300
"reason": "Overlapping patches detected",
301301
"hash": None,
302-
"content": current_content,
302+
"content": None,
303303
}
304304

305305
# Apply patches
@@ -333,7 +333,7 @@ async def edit_file_contents(
333333
"result": "error",
334334
"reason": "Unexpected error",
335335
"file_hash": None,
336-
"content": current_content,
336+
"content": None,
337337
}
338338

339339
# Calculate line ranges for zero-based indexing

0 commit comments

Comments
 (0)