Skip to content

Check for name property on appended form values.#163

Closed
DylanPiercey wants to merge 1 commit intoform-data:masterfrom
DylanPiercey:master
Closed

Check for name property on appended form values.#163
DylanPiercey wants to merge 1 commit intoform-data:masterfrom
DylanPiercey:master

Conversation

@DylanPiercey
Copy link
Copy Markdown
Member

This allows correct filename parsing from formidable streams and libraries that mimic the browser api such as "node-file-api" by checking for a ".name" property on appended streams.

@alexindigo what are your thoughts on this?

@review-ninja
Copy link
Copy Markdown

ReviewNinja

@alexindigo
Copy link
Copy Markdown
Member

Seems like bunch of unhappy things, although it might be preexisting condition.

I'm a bit confused on "formidable stream" part. I always considered formidable to be on the receiving end only. Can you elaborate a bit more?

Thanks.

@DylanPiercey
Copy link
Copy Markdown
Member Author

@alexindigo It doesn't look like the issues stem from this PR. As far as the formidable bit goes I may have gotten confused. For Rill (the body parser) I use formidable files but convert them to a read stream, so I guess you can't use formidable files asis with form-data.

Still however I think this is a nicety for isomorphic libs since https://developer.mozilla.org/en/docs/Web/API/File and https://github.com/felixge/node-formidable#user-content-formidablefile both expose a "name" property. I don't think there would be any negatives to this PR except allowing more apis to work with form-data.

Comment thread lib/form_data.js
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My main concern that value.name could be many different things
and we might end up with bunch of false positives.

Can you provide separate integration test instead of augmenting existing custom filename test,
it would better illustrate the use case and would allow for better understanding why we have that piece of code six months from now :)

@alexindigo
Copy link
Copy Markdown
Member

Meanwhile I'll cleanup preexisting triggers.

Comment thread lib/form_data.js
'Content-Type': [].concat(contentType || [])
};

// allow custom headers.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@DylanPiercey
Copy link
Copy Markdown
Member Author

Messed this one up by force pushing -_-.

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

Successfully merging this pull request may close these issues.

3 participants