-
-
Notifications
You must be signed in to change notification settings - Fork 7.4k
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
Support multiple file upload validation #10343
Conversation
Pull Request Test Coverage Report for Build eb1f30dd-90b6-4c45-9f27-fe86506c8ee6
💛 - Coveralls |
@@ -39,7 +39,7 @@ export class ParseFilePipe implements PipeTransform<any> { | |||
} | |||
|
|||
async transform(value: any): Promise<any> { | |||
if (isUndefined(value)) { | |||
if (isUndefined(value) || (Array.isArray(value) && isEmpty(value))) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@thiagomini I think you implemented this pipe, correct? 🙌 If so, could you verify this PR?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
First, I would like to thank you for your time invested into this bug fix! I left some suggestions to improve the readability of the code, but of utmost importance is the addition of automated tests that cover this feature. Can you create such tests for the correspondent spec file? Thanks!
Hey @blangley28 , could you work on the changes I've asked? Thanks! |
@thiagomini sorry for the delay. Just pushed some updated. I also found that while using |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have reported missing some semicolons in some code statements
No problem @blangley28! Now you only have to fix the tests and add the new ones. |
Hello, Is this being continued? I really would like to have this since I need to validate multiple files. I hope it gets merged soon! |
Hey @PhelixTaken. We cannot merge this PR until it has all tests passing. You are welcome to create a branch that resolves this problem as well, I would be happy to review it! I can work on that issue too once I have some time, but I can't promise you a date. |
Thank you for the great efforts. I want to add that private thereAreNoFilesIn(value: any): boolean {
if (Array.isArray(value)) {
return value.length === 0;
} else if (isObject(value)) {
return Object.keys(value).length === 0;
} else {
return isEmpty(value);
}
} also my code passed I would love to help in this PR. just let me know :) |
Let's track this here #10737 |
PR Checklist
Please check if your PR fulfills the following requirements:
PR Type
What kind of change does this PR introduce?
What is the current behavior?
Currently file validation via the
ParseFilePipe
only works when validating a single file. When using an array of files it always throws an error.Issue Number: N/A
What is the new behavior?
Single file validation continues to work unchanged, but now when uploading multiple files:
fileIsRequired
worksDoes this PR introduce a breaking change?
Other information