expressjs / multer

Node.js middleware for handling `multipart/form-data`.
MIT License
11.62k stars 1.06k forks source link

Multer removes uploaded files when an exception occurs #1279

Open simo385 opened 1 month ago

simo385 commented 1 month ago

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

simo385 commented 3 weeks ago

Dear All,

updates?

Thanks in advance Simone