Skip to content

Commit 5e28077

Browse files
committed
Fix an issue where recursion is broken due to no new line chars
1 parent 60521e9 commit 5e28077

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

mfr/extensions/tabular/libs/stdlib_tools.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,11 @@ def _trim_or_append_data(fp, text, read_size, sniff_size):
123123
:return: the first row of the file in string
124124
"""
125125

126+
# Return on empty text. This handles the corner case where the CSV is empty or one line where
127+
# no new line characters can be detected.
128+
if len(text) == 0:
129+
return ''
130+
126131
# Try to find the first new line character in the text chunk
127132
index = _find_new_line(text)
128133
# If found, return the trimmed substring

0 commit comments

Comments
 (0)