Skip to content

Commit

Permalink
Relax hosts validation in Beats central management (#25376)
Browse files Browse the repository at this point in the history
Current regexp was disallowing schema part of the URL (https://), so
https hosts couldn't be configured.

I opted for fully relaxing the reg exp here, as Beat will check it
anyway, and report errors in case it's wrong.
  • Loading branch information
exekias authored and mattapperson committed Nov 8, 2018
1 parent dfaa659 commit 91c688c
Showing 1 changed file with 2 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,23 +19,8 @@ import {
} from '../../inputs';

addValidationRule('isHosts', (form: FormData, values: FieldValue | string[]) => {
if (values && values.length > 0 && values instanceof Array) {
return values.reduce((pass: boolean, value: string) => {
if (
pass &&
value.match(
new RegExp(
'^(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9-]*[a-zA-Z0-9]).)*([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9-]*[A-Za-z0-9])$'
)
) !== null
) {
return true;
}
return false;
}, true);
} else {
return true;
}
// TODO add more validation
return true;
});

addValidationRule('isString', (values: FormData, value: FieldValue) => {
Expand All @@ -54,7 +39,6 @@ addValidationRule('isPath', (values: FormData, value: FieldValue) => {

addValidationRule('isPaths', (values: FormData, value: FieldValue) => {
// TODO add more validation

return true;
});

Expand Down

0 comments on commit 91c688c

Please sign in to comment.