algolia / algolia/algolia-csv-js

Error Parsing with # symbols

Open
#3 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
11
Forks
2
PR merge metrics
No merged PRs in 30d

Description

Hello, I've found this tool really useful. However I git stuck while trying to upload a CSV with cell values starting with `#`. I'm assuming it's being read as #ERROR.

Here's the stack trace:
```
Reading from file : buildings_sg.csv
Parsing CSV
Clearing data in index
Saving to algolia
Saving to algolia
Saved/updated 10000 records
Saving to algolia
events.js:183
throw er; // Unhandled 'error' event
^

Error: Number of columns on line 36459 does not match header
at Parser.__push (/Users/martinverdejo/.nvm/versions/node/v8.9.4/lib/node_modules/algolia-csv/node_modules/csv-parse/lib/index.js:272:14)
at Parser.__write (/Users/martinverdejo/.nvm/versions/node/v8.9.4/lib/node_modules/algolia-csv/node_modules/csv-parse/lib/index.js:496:20)
at Parser._transform (/Users/martinverdejo/.nvm/versions/node/v8.9.4/lib/node_modules/algolia-csv/node_modules/csv-parse/lib/index.js:207:14)
at Parser.Transform._read (_stream_transform.js:186:10)
at Parser.Transform._write (_stream_transform.js:174:12)
at doWrite (_stream_writable.js:387:12)
at writeOrBuffer (_stream_writable.js:373:5)
at Parser.Writable.write (_stream_writable.js:290:11)
at ReadStream.ondata (_stream_readable.js:639:20)
at emitOne (events.js:116:13)
```

My row 36459 looks like the following:

```
# 1 LOFT | 398614 | # 1 LOFT | 1.31276346405246 | 103.883518875617 | 33586.8152234554 | 32784.2877238821
```

Is there a way to escape this and similar strings?

Contributor guide

No contributing guide indexed for this repository

Research direction

Reproduce the failure with buildings_sg.csv, focusing on line 36459 and the CSV parsing path shown in the stack trace, including csv-parse/lib/index.js. Check how fields beginning with # are handled and verify that the row parses without a column-count error while preserving the original values.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, node.js
Domain
cli
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.