Skip to content

Conversation

@divya2212001
Copy link

Summary

Fixes an off-by-one issue where Multer throws a "File too large" error
when the uploaded file size is exactly equal to limits.fileSize.

Root Cause

Busboy emits a limit event when the file size equals the limit.
Multer interpreted this as an overflow, rejecting valid uploads.

Fix

Adjusted the limit logic by incrementing limits.fileSize by 1 before
passing to Busboy. This ensures only files exceeding the limit are rejected.

Testing

✅ Uploaded files with size exactly equal to limits.fileSize → success
✅ Uploaded files exceeding the limit → correctly rejected

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.

1 participant