Skip to content

Commit 1bde0d6

Browse files
committed
Truncate the column name in case it's too long (2k chars)
1 parent e7993a8 commit 1bde0d6

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/init_parsing.jl

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,8 @@ function process_header_and_schema_and_finish_row_skip!(
101101
try
102102
push!(parsing_ctx.header, Symbol(identifier_s))
103103
catch
104-
throw(HeaderParsingError("Error parsing header for column $i ('$(identifier_s)') at " *
104+
# defensively truncate identifier_s to 2k characters in case something is very cursed
105+
throw(HeaderParsingError("Error parsing header for column $i ('$(first(identifier_s, 2000))') at " *
105106
"$(lines_skipped_total+1):$pos (row:pos): presence of invalid non text bytes in the CSV snippet"))
106107
end
107108
end
@@ -176,7 +177,8 @@ function process_header_and_schema_and_finish_row_skip!(
176177
try
177178
push!(parsing_ctx.header, Symbol(identifier_s))
178179
catch
179-
throw(HeaderParsingError("Error parsing header for column $i ('$(identifier_s)') at " *
180+
# defensively truncate identifier_s to 2k characters in case something is very cursed
181+
throw(HeaderParsingError("Error parsing header for column $i ('$(first(identifier_s, 2000))') at " *
180182
"$(lines_skipped_total+1):$pos (row:pos): presence of invalid non text bytes in the CSV snippet"))
181183
end
182184
end

0 commit comments

Comments
 (0)