Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions test/test_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -499,6 +499,9 @@ def test_is_weaviate_client_too_old(current_version: str, latest_version: str, t
('\\\\"', '\\\\\\"'),
('\\\\"', '\\\\\\"'),
('\\\\\\"', '\\\\\\"'),
("foo\nbar", "foo bar"),
("foo\r\nbar", "foo bar"),
("foo\rbar", "foo bar"),
],
)
def test_sanitize_str(in_str: str, out_str: str) -> None:
Expand Down
4 changes: 3 additions & 1 deletion weaviate/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -497,7 +497,9 @@ def is_weaviate_domain(url: str) -> bool:


def strip_newlines(s: str) -> str:
return s.replace("\n", " ")
# GraphQL treats CR as a line terminator inside string literals just like LF,
# so a CRLF value must collapse to one space instead of leaving a bare CR.
return s.replace("\r\n", "\n").replace("\r", "\n").replace("\n", " ")


def _sanitize_str(value: str) -> str:
Expand Down
Loading