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

fix: Use fileBegin hook to properly fail when maxFiles is exceeded #881

Merged
merged 1 commit into from
Aug 22, 2022

Conversation

coloursofnoise
Copy link
Contributor

Currently, using the "file" (file completion) hook to check the maxFiles restriction allows an extra file to be uploaded.

This is because if _error is called after the last file is uploaded, this.ended is already set to true and the error is ignored.

By using the "fileBegin" hook instead, the error is triggered before the file has finished uploading.
This also allows the server to fail immediately upon the file upload, which means it doesn't have to wait for the extra upload that will be discarded anyways.

Copy link
Contributor

@GrosSacASac GrosSacASac left a comment

Choose a reason for hiding this comment

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

Thanks

@GrosSacASac GrosSacASac merged commit d285a08 into node-formidable:master Aug 22, 2022
@GrosSacASac
Copy link
Contributor

published as formidable@3.2.5

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.

2 participants