Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using form name arrays without defined key name causes a TypeError. #21

Closed
jakeandreoli opened this issue Apr 29, 2017 · 2 comments
Closed

Comments

@jakeandreoli
Copy link

jakeandreoli commented Apr 29, 2017

I found an issue when trying to use array values without a defined key name. This can be easily replicated.

I am unsure if this is an issue in the wrapper or the original code, though the error occurs in the reconcile function, which is not present in the synchronous version; hence why I am sharing the issue here.

<input type="password" name="password[]"> <!-- Should be treated as password[0] -->
<input type="password" name="password[]"> <!-- Should be treated as password[1] -->

The actual error occurring:

TypeError: Cannot create property 'undefined' on string ''
    at reconcile (Path\To\Project\node_modules\async-busboy\index.js:208:24)
    at reconcile (Path\To\Project\node_modules\async-busboy\index.js:206:12)
    at reconcile (Path\To\Project\node_modules\async-busboy\index.js:206:12)
    at onField (Path\To\Project\node_modules\async-busboy\index.js:84:5)
    at emitMany (events.js:127:13)
    at Busboy.emit (events.js:204:7)
    at Busboy.emit (Path\To\Project\node_modules\busboy\lib\main.js:38:33)
    at UrlEncoded.end (Path\To\Project\node_modules\busboy\lib\types\urlencoded.js:205:14)
    at Busboy.emit (Path\To\Project\node_modules\busboy\lib\main.js:31:36)
    at finishMaybe (_stream_writable.js:510:14)
    at endWritable (_stream_writable.js:520:3)
    at Busboy.Writable.end (_stream_writable.js:485:5)
    at IncomingMessage.onend (_stream_readable.js:511:10)
    at Object.onceWrapper (events.js:293:19)
    at emitNone (events.js:86:13)
    at IncomingMessage.emit (events.js:188:7)
    at endReadableNT (_stream_readable.js:974:12)
    at _combinedTickCallback (internal/process/next_tick.js:80:11)
    at process._tickCallback (internal/process/next_tick.js:104:9)

Putting the following works around the issue, however creates problems when dynamically creating elements based on user interaction:

<input type="password" name="password[0]">
<input type="password" name="password[1]">
@jakeandreoli
Copy link
Author

I added a pull request that adds support for this #22 and refactored code to allow this to work.

@m4nuC
Copy link
Owner

m4nuC commented May 4, 2017

Hi @jakeandreoli, thanks for the PR. I've merged #20 to address this problem. I will keep you PR open for now as it might come in handy later.

@m4nuC m4nuC closed this as completed May 4, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants