fix(documents): preserve universal newlines
This commit is contained in:
1 parent
7355b35055
commit
e48f1ae65b
1 file changed
+1
@@ -626,6 +626,7 @@ def _extract_text_file(path: Path) -> str:
|
|||||||
content = raw.decode("utf-8")
|
content = raw.decode("utf-8")
|
||||||
except UnicodeDecodeError:
|
except UnicodeDecodeError:
|
||||||
content = raw.decode("latin-1")
|
content = raw.decode("latin-1")
|
||||||
|
content = content.replace("\r\n", "\n").replace("\r", "\n")
|
||||||
return _truncate(content, _MAX_TEXT_LENGTH)
|
return _truncate(content, _MAX_TEXT_LENGTH)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.exception("Failed to read text file {}", path)
|
logger.exception("Failed to read text file {}", path)
|
||||||
|
|||||||
Reference in new issue
Block a user