From e48f1ae65b7bed054465ac7b76e273f827d02d3b Mon Sep 17 00:00:00 2001 From: Zihan Xu <2024010904024@std.uestc.edu.cn> Date: Tue, 22 Sep 2026 21:47:04 +0800 Subject: [PATCH] fix(documents): preserve universal newlines --- nanobot/utils/document.py | 1 + 1 file changed, 1 insertion(+) diff --git a/nanobot/utils/document.py b/nanobot/utils/document.py index 136e9e73f..7e9727ab3 100644 --- a/nanobot/utils/document.py +++ b/nanobot/utils/document.py @@ -626,6 +626,7 @@ def _extract_text_file(path: Path) -> str: content = raw.decode("utf-8") except UnicodeDecodeError: content = raw.decode("latin-1") + content = content.replace("\r\n", "\n").replace("\r", "\n") return _truncate(content, _MAX_TEXT_LENGTH) except Exception as e: logger.exception("Failed to read text file {}", path)