From 1bde0d63043f820514e553c7a871360108c4d734 Mon Sep 17 00:00:00 2001 From: Dean De Leo Date: Wed, 22 Nov 2023 15:56:20 +0100 Subject: [PATCH] Truncate the column name in case it's too long (2k chars) --- src/init_parsing.jl | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/init_parsing.jl b/src/init_parsing.jl index d9f0214..1359c1f 100644 --- a/src/init_parsing.jl +++ b/src/init_parsing.jl @@ -101,7 +101,8 @@ function process_header_and_schema_and_finish_row_skip!( try push!(parsing_ctx.header, Symbol(identifier_s)) catch - throw(HeaderParsingError("Error parsing header for column $i ('$(identifier_s)') at " * + # defensively truncate identifier_s to 2k characters in case something is very cursed + throw(HeaderParsingError("Error parsing header for column $i ('$(first(identifier_s, 2000))') at " * "$(lines_skipped_total+1):$pos (row:pos): presence of invalid non text bytes in the CSV snippet")) end end @@ -176,7 +177,8 @@ function process_header_and_schema_and_finish_row_skip!( try push!(parsing_ctx.header, Symbol(identifier_s)) catch - throw(HeaderParsingError("Error parsing header for column $i ('$(identifier_s)') at " * + # defensively truncate identifier_s to 2k characters in case something is very cursed + throw(HeaderParsingError("Error parsing header for column $i ('$(first(identifier_s, 2000))') at " * "$(lines_skipped_total+1):$pos (row:pos): presence of invalid non text bytes in the CSV snippet")) end end