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
Support Field Filter #875
base: master
Are you sure you want to change the base?
Support Field Filter #875
Conversation
@irfanfs you pinged the closed PR I made (accident) This is the right PR. If they merge this I imagine they'd pub 1.4.3 too. |
run @noonii Would you mind expanding on the use case for this? None of the other express body parsers offers functionality to filter what goes into Maybe this is better handled by a form validation library? |
Server side validation. Use case no. 1
Use case no. 2
Without the filter in all cases the file is uploaded to host and then leaving the app to validate and remove the file accordingly. The code to handle all of this efficiently exists in multer already, so it becomes redundant to the app. I suggest removing the redundancy. Bonus: only in use case no.1 would it serve best because it handles aborting before the upload. I run a service at scale that would benefit from this. |
If this field filter would also get the mime type of the field and could transform the value (i.e. the callback should get a 3rd parameter: the transformed value) than my pull request would be obsolete: #1037 |
Because multer parses FormData based on the order of inputted values, sometimes file is parsed before fields. Ideally, if we can filter fields and reject before file upload that would be best.
Even so, we want to filter/validate fields and abort if necessary.
EDIT: Can this be implemented for the deprecated and 2.0