fastify / fastify/fastify-multipart

cleanRequestFiles doesn't clean file when file size is reached

Open
#470 10 comments 0 reactions 0 assignees View on GitHub
need info
Dominant language
JavaScript
Stars
539
Forks
126
PR merge metrics
No merged PRs in 30d

Description

### Prerequisites

- [X] I have written a descriptive issue title
- [X] I have searched existing issues to ensure the bug has not already been reported

### Fastify version

4.21.0

### Plugin version

7.7.3

### Node.js version

18.16.0

### Operating system

Linux

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

Ubuntu 22.04.2 LTS (wsl2)

### Description

When calling `cleanRequestFiles` after the error "request file too large" happens, it doesn't clean the temp file, as i suggestion this file should be removed automatically if the file is bigger than the max size.

### Steps to Reproduce

Set file maxSize, for example:

```ts
await request.saveRequestFiles({
limits: {
fileSize: 1, // 1 byte
},
})
```

and after the error is thrown, call `cleanRequestFiles`.

### Expected Behavior

The file should be cleared

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.