Skip to content

Commit

Permalink
Change to RegExp
Browse files Browse the repository at this point in the history
  • Loading branch information
cnasikas committed Feb 8, 2021
1 parent ad932e4 commit 058a9bc
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ export const ExecutorSubActionPushParamsSchema = schema.object({
schema.arrayOf(
schema.string({
validate: (label) =>
label.includes(' ') ? `The label ${label} cannot contain spaces` : undefined,
// Matches any space, tab or newline character.
label.match(/\s/g) ? `The label ${label} cannot contain spaces` : undefined,
})
)
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ export function getActionType(): ActionTypeModel<JiraConfig, JiraSecrets, JiraAc

if (actionParams.subActionParams?.incident?.labels?.length) {
// Jira do not allows empty spaces on labels. If the label includes a whitespace show an error.
if (actionParams.subActionParams.incident.labels.some((label) => label.includes(' ')))
if (actionParams.subActionParams.incident.labels.some((label) => label.match(/\s/g)))
errors['subActionParams.incident.labels'].push(i18n.LABELS_WHITE_SPACES);
}
return validationResult;
Expand Down

0 comments on commit 058a9bc

Please sign in to comment.