-
-
Notifications
You must be signed in to change notification settings - Fork 7.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Provide Validation for FileInterceptor/UploadedFile to Ensure a File is Actually Uploaded #4752
Comments
I like both ideas 🙂 The second one should be easier to implement though. Would you like to create a PR with eg |
@WonderPanda both of the ideas look great. |
Apologies guys life has been super busy the last couple weeks as I'm transitioning jobs at the moment. I'll look at getting a PR up for this this week |
@WonderPanda really interested in this, both ideas seem great! |
Any updates on this? |
Is anyone working on this? |
@JeromeGill @mertcanekiz @Langstra PRs are more than welcome! There's no PR targeting this issue atm |
Hi, @kamilmysliwiec is this issue still need a PR? I would love to give it a shot :) |
@omer-morad-ni yes, PR would be more than welcome |
@omer-morad-ni any word on your idea? :) |
Sorry for the late response! |
also adding types for multer so that we can specify the interfaces nestjs#4752
also adding types for multer so that we can specify the interfaces nestjs#4752
The two decorators @uploadedfile and @uploadedfiles have been marked as pipeable, however this had no affect as this method was preventing their execution. Original Issue nestjs#4752 Bug fixed by this commit nestjs#6344 (comment)
@kamilmysliwiec is this issue still open, if so i could help out! |
Still open yes! @mdaj06 |
Shall I have a go at it @kamilmysliwiec ? |
Sounds great! |
This adds an option for file interceptor to throw if no files are found Closes nestjs#4752
Any solutions so far? |
This will be added in v9.0.0 |
Feature Request
Provide a built in way to ensure that when using
@FileInterceptor
that it is easy to validate the scenario where no file was actually sent to the backendIs your feature request related to a problem? Please describe.
The current
@UploadedFile
implementation doesn't allow it to participate in Pipes validation. Even if it did, many users would have to implement a custom Pipe to ensure that the file was set in UserLand code. This seems like a common enough scenario that it would make sense for NestJS to support an out of the box solutionDescribe the solution you'd like
One of:
@FileInterceptor
so that it takes (optional) additional configuration that indicates an error should be thrown if no file/files are found at the specified fields.@UploadedFile
decorator so that it can participate in Pipes validation and then provide a built in Pipe egParseFile
What is the motivation / use case for changing the behavior?
Seamless out of the box experience for dealing with file uploading. Less duplication in user land code to cover common community scenarios
Notes
I'd be happy to open up a PR for this if there is some guidance regarding which approach would be preferred
The text was updated successfully, but these errors were encountered: