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

added support for fieldNameSize #59

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

jpfluger
Copy link

Hi. I added support for fieldNameSize and corresponding test parameters. Kept the 100 byte default, as specified by the documentation. This way if anyone says busboy broke their implementation, well, the intention was always for the default to be 100 bytes. Only put the functionality in place for content-disposition for multi-part data. If this was wrong or I'm missing something, please let me know. Otherwise this should close issue #6 for you. Thanks for the library. I'm using it via multer and am trying to harden the security of my submission system. Oh, and added a .gitignore file. Hope that's okay too. Thanks again for the library. (p.s. I didn't give this a version bump, though)

: Infinity);
: Infinity),
fieldNameSizeLimit = (limits && typeof limits.fieldNameSize === 'number'
? limits.fieldNameSize
Copy link
Owner

Choose a reason for hiding this comment

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

alignment is off here

@mscdex
Copy link
Owner

mscdex commented Oct 2, 2014

I think we should also have a fieldNameTruncated kind of property like we have for urlencoded forms. Maybe at the same time we change up what is passed to file event handlers in order to reduce the number of arguments. If we passed an object we would just tack fieldNameTruncated on to that object passed to the file event handlers.

I'm not sure what that would look like. Originally I tried to keep the parameters used for both field and file the "same" (key, val), but maybe we just depart from that and just pass a single object to file event handlers...

@jpfluger
Copy link
Author

jpfluger commented Oct 2, 2014

Well, I'm glad you proposed fieldNameTruncated and not me! 👍 I had thought about incorporating it originally but thought I'd make a mistake somewhere due to me being new to this code. I'd be happy to work with you on making this happen. I'll take a fresh look at the source late tonight with what you suggested and post my thoughts then.

@jpfluger
Copy link
Author

jpfluger commented Oct 3, 2014

I cleaned up the files per your original comments and reran the npm test (which passed).

Re. truncated field. Along the lines of the idea in your first paragraph. So return an object from parseParams? That object would have the current results array and a second Boolean property for fieldNameTruncated. Then like you say you could assign that as an ending parameter to

boy.emit('file', fieldname, file, filename, encoding, contype, fieldNameTruncated);

Then at least this shouldn't break higher-level functionality, who may be listening to the file emitter. (eg the express/multer module).

jpfluger referenced this pull request in expressjs/multer Feb 20, 2015
@niftylettuce
Copy link

Any update on this?

@kibertoad
Copy link

@jpfluger If by any chance you are still interested in landing this, would you consider rebasing this towards https://github.com/fastify/busboy? We've created a fork that we intend to maintain within the fastify organization due to original repo growing stale in the latest years, and hopefully larger community can benefit from that.

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.

None yet

4 participants