mholt/PapaParse

Wrong row reported for `InvalidQuotes`

Open

#432 aberto em 8 de nov. de 2017

Ver no GitHub
 (3 comments) (0 reactions) (0 assignees)JavaScript (1.157 forks)batch import
help wanted

Métricas do repositório

Stars
 (11.877 stars)
Métricas de merge de PR
 (Nenhuma PRs mesclada em 30d)

Description

With version 4.3.6, in some cases, the wrong row is reported. A test case:

Papa.parse(
  `a,b,c
   1,2,3,
   4,"5"5",6
   7,8,9`, 
{header:true}).errors

Results in

[
  {"type":"Quotes","code":"InvalidQuotes","message":"Trailing quote on quoted field is malformed","row":2,"index":16},
  {"type":"FieldMismatch","code":"TooManyFields","message":"Too many fields: expected 3 fields but parsed 4","row":0}
]

A field mismatch occurs on row 0 and then one expects the invalid quotes to be reported on row 1 but it's on row 2 instead. This doesn't happen with version 4.3.5 which doesn't report the invalid quotes at all.

Here's the fiddle https://jsfiddle.net/011ev54k/

Guia do colaborador