-
Notifications
You must be signed in to change notification settings - Fork 114
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
Add: Validation for Policy Upload #634
base: main
Are you sure you want to change the base?
Conversation
|
||
const handleDrop = (policyDefinition: any) => { | ||
setPolicyDefinitionFile(policyDefinition); | ||
if(policyDefinition===null || policyDefinition===undefined) { |
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.
Formatting issues
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.
And also this can be simplified as follows.
const handleDrop = (policyDefinition: any) => {
if (policyDefinition && policyDefinition[0] && (policyDefinition[0].name.endsWith('.j2') || policyDefinition[0].name.endsWith('.xml'))) {
setPolicyDefinitionFile(policyDefinition);
return;
}
APIMAlert.error(intl.formatMessage({
id: 'Uploading.Policies.Error',
defaultMessage: 'Incompatible file type',
}));
};
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.
Done
Will add the backend validation as backend does not return an error on adding an incompatible policy file |
…development iteration
Simplified the logic
307516d
to
60ef32d
Compare
|
Quality Gate failedFailed conditions |
Purpose
.j2
and.xml
Fixes: wso2/api-manager#2663