aoa_to_sheet() crashes browser if you pass an array of objects #1214
Labels
No Label
DBF
Dates
Defined Names
Features
Formula
HTML
Images
Infrastructure
Integration
International
ODS
Operations
Performance
PivotTables
Pro
Protection
Read Bug
SSF
SYLK
Style
Write Bug
good first issue
No Milestone
No Assignees
1 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: sheetjs/sheetjs#1214
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
I know you're not supposed to do this, but if you pass an array of objects into
aoa_to_sheet()
it gets stuck in an infinite loop.E.g.
JSfiddle
Might be good to throw an exception in this situation ;)
The function assumes an array of arrays is passed in. The infinite loop comes from the inequality check in https://github.com/SheetJS/js-xlsx/blob/master/bits/27_csfutils.js#L104 -- when you pass an object like
{hello: "world"}
,length
is undefined and the loop doesn't terminate.The fix is to make a check just before that line:
(@mnori feel free to submit this as a PR)
Browser main thread is blocked for 30 mins to process array of array to sheet --> UI froze.. any ways to fix this ?