fix(files): treat BOM-only text as empty

This commit is contained in:
chengyongru authored and chengyongru committed 2026-09-23 00:29:52 +08:00
1 parent e48f1ae65b
commit a721806a50
2 files changed
+13

No files matched your search

+3
View File
@@ -375,6 +375,9 @@ class ReadFileTool(_FsTool):
"Only supported text files and images can be read."
)
if not text_content:
return f"(Empty file: {path})"
# Normalize CRLF -> LF before line-splitting. Primarily a Windows
# concern (git checkouts with autocrlf, editors saving CRLF) but
# applied on all platforms so downstream StrReplace/Grep behavior