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

RequestFileTooLargeError is not raised with streams even though fileSize limit is set #383

Closed
2 tasks done
svsool opened this issue Aug 26, 2022 · 1 comment · Fixed by #389
Closed
2 tasks done

Comments

@svsool
Copy link

svsool commented Aug 26, 2022

Prerequisites

  • I have written a descriptive issue title
  • I have searched existing issues to ensure the bug has not already been reported

Fastify version

4.4.0

Plugin version

7.1.0

Node.js version

18.0.0

Operating system

macOS

Operating system version (i.e. 20.04, 11.3, 10)

12.3

Description

Thanks for this plugin.

I use @fastify/multipart for image upload and noticed that RequestFileTooLargeError is not raised with file streams in production env.

Here is the test in the current codebase that supposed to test that this error raised and it's raised with in-memory random buffer not bound to disk IO delays.

Although if one replaces randomFileBuffer with real stream fs.createReadStream('/tmp/images/15mb.jpeg') bigger than fileSize test starts to fail, but it expected to pass.

image

image

It's not obvious to me why error is not propagated in this case or should it at all.

Steps to Reproduce

Replace randomFileBuffer with fs.createReadStream('/tmp/images/15mb.jpeg') in this test.

Expected Behavior

I expect that RequestFileTooLargeError would be raised when read stream supplied.

@mcollina
Copy link
Member

Thanks for reporting! Would you like to send a Pull Request to address this issue? Remember to add unit tests.

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 a pull request may close this issue.

2 participants