fix(documents): preserve universal newlines

This commit is contained in:
Zihan Xu authored and chengyongru committed 2026-09-23 00:29:52 +08:00
1 parent 7355b35055
commit e48f1ae65b
1 file changed
+1
+1
View File
@@ -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)