expressjs / expressjs/multer

Multer removes uploaded files when an exception occurs

Open
#1,279 1 comment 0 reactions 0 assignees View on GitHub
bug
Dominant language
JavaScript
Stars
12.1k
Forks
1.1k
Avg merge
8d 2h
Merged PRs (30d)
21

Description

Hi everybody,

We developed an express API to upload multiple files to S3. The API works successfully, but we've noticed a weird behavior when an exception occurs when multiple files are uploaded.

### Scenario
Suppose we upload 10 files where the 7th and 9th exceed the size limit.

### Current behavior
The API catches the error successfully, but, any file to S3 is uploaded.

### Expected behavior
Files 1,2,3,4,5,6,8,10 should be uploaded to S3 successfully, on the other hand, the Multer should inform us that files 7 and 9 have not been uploaded because of the "LIMIT_FILE_SIZE" exception.

### Environment
Node 20
Express4
AWS S3 (storage)

IMHO, this bug should be fixed asap, to avoid unexpected behavior in the future.

Thanks in advance,
Simone

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.