dmitriy-nz / nestjs-form-data

NestJS middleware for handling multipart/form-data, which is primarily used for uploading files.
https://www.npmjs.com/package/nestjs-form-data
MIT License
117 stars 23 forks source link

Remove file after validation failed #22

Closed julianpoemp closed 2 years ago

julianpoemp commented 2 years ago

This package is what I'm looking for, thank you! I added a custom StoredFile class that automatically hashes the file during the upload. Works like a charm!

I found out that the uploaded file is not removed automatically after the validation of the DTO failed. Does this work as expected or is this a bug? If it's not a bug, how can I implement it so the file is going to be removed after validation failed? I thought the file would be removed automatically after the request failed.

dmitriy-nz commented 2 years ago

Hello, thanks for the positive feedback. After unsuccessful validation through decorators, the file was not deleted, this is a bug. I fixed it in the new version of nestjs-form-data@1.6.3, please check.