diff --git a/src/portal/lib/src/create-edit-rule/create-edit-rule.component.ts b/src/portal/lib/src/create-edit-rule/create-edit-rule.component.ts index 2ecf2ffca1..eb61d1074b 100644 --- a/src/portal/lib/src/create-edit-rule/create-edit-rule.component.ts +++ b/src/portal/lib/src/create-edit-rule/create-edit-rule.component.ts @@ -138,8 +138,8 @@ export class CreateEditRuleComponent implements OnInit, OnDestroy { }); } trimText(event) { - if (event.srcElement.value) { - event.srcElement.value = event.srcElement.value.trim(); + if (event.target.value) { + event.target.value = event.target.value.trim(); } } equals(c1: any, c2: any): boolean { diff --git a/src/portal/src/app/project/tag-retention/add-rule/add-rule.component.ts b/src/portal/src/app/project/tag-retention/add-rule/add-rule.component.ts index 9a6d9ce245..f8cb51bd9d 100644 --- a/src/portal/src/app/project/tag-retention/add-rule/add-rule.component.ts +++ b/src/portal/src/app/project/tag-retention/add-rule/add-rule.component.ts @@ -179,6 +179,9 @@ export class AddRuleComponent implements OnInit, OnDestroy { } add() { + // remove whitespaces + this.rule.scope_selectors.repository[0].pattern = this.rule.scope_selectors.repository[0].pattern.replace(/\s+/g, ""); + this.rule.tag_selectors[0].pattern = this.rule.tag_selectors[0].pattern.replace(/\s+/g, ""); if (this.rule.scope_selectors.repository[0].decoration !== "repoMatches" && this.rule.scope_selectors.repository[0].pattern.indexOf("**") !== -1) { this.inlineAlert.showInlineError(INVALID_RULE);