fileSize limit on fastify-multipart did not throw error
See original GitHub issueI don’t know if I use it correctly or not but it is just pass through if I passing file with size higher than limit.
/*
* other code
*/
fastify.post('/upload', async function (req, reply) {
const data = await req.file({
limits: {
fileSize: 1 * 1024 * 1024, // 1mb limit
}
})
await pump(data.file, fs.createWriteStream(data.filename))
reply.send()
})
It write file to my directory, when I expect it to throw error
- node version: 14.15.3
- fastify version: 3.9.2
- fastify multipart version: 3.3.1
- os: WSL
Issue Analytics
- State:
- Created 3 years ago
- Comments:20 (14 by maintainers)
Top Results From Across the Web
fileSize limit on fastify-multipart did not throw error
Coming soon: A brand new website interface for an even better experience!
Read more >fastify-multipart - npm
If you set a fileSize limit, it is able to throw a RequestFileTooLargeError error when limit reached. fastify.post('/upload/files', ...
Read more >Fastify multipart/form-data error: "body must be object"
I'm using fastify-multer and JSON Schema to submit multipart form data that may include a file. No matter what I do, Fastify keeps...
Read more >fastify/busboy - NPM Package Overview - Socket.dev
Start using Socket to analyze @fastify/busboy and its 1 ... If a configured file size limit was reached, stream will both have a...
Read more >File upload | NestJS - A progressive Node.js framework
Warning Multer cannot process data which is not in the supported multipart format ( multipart/form-data ). Also, note that this package is not...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I guess we should error this.
I think the current behavior is correct because we can only guarantee error handling for a stream when we iterate over all
parts
untilonEnd
is called. In all other cases, the user can check forfile.truncated
after the stream was consumed. Thereq.file
API is error-prone because it can’t report the final error.I couldn’t reproduce it. It is only valid for
req.file
. Please provide a reproducible example.