Skip to content
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

required validation for file is not executed #1737

Open
2 tasks
kchobantonov opened this issue Jan 5, 2025 · 2 comments · May be fixed by #1739
Open
2 tasks

required validation for file is not executed #1737

kchobantonov opened this issue Jan 5, 2025 · 2 comments · May be fixed by #1739

Comments

@kchobantonov
Copy link

Sorting

  • I'm submitting a ...

    • [ X] bug report
    • feature request
    • support request
  • I confirm that I

    • [X ] used the search to make sure that a similar issue hasn't already been submit

Expected Behavior

Should get a validation error response for required file/files

Current Behavior

No validation is performed when the file(s) is not provided.

Possible Solution

In expressTemplateService.ts do not immediately return undefined when the parameter is not found - like this code

if (requestFiles[name] === undefined) {
  return undefined;
}

Steps to Reproduce

Define the controller method as

  @Post('File')
  public async postWithFile(@UploadedFile('someFile') aFile: File): Promise<File> {
    return aFile;
  }

  1. execute a request again the /File without providing the someFile field in the request
  2. Check that not validation is performed

Context (Environment)

Version of the library: 6.6.0
Version of NodeJS: v18.19.0

  • Confirm you were using yarn not npm: [ x]

Detailed Description

Will provide a pull request shortly with the actual changes.

Breaking change?

Copy link

github-actions bot commented Jan 5, 2025

Hello there kchobantonov 👋

Thank you for opening your very first issue in this project.

We will try to get back to you as soon as we can.👀

@kchobantonov
Copy link
Author

fixed by #1739

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant