Skip to content

Commit

Permalink
Merge pull request Expensify#46556 from bernhardoj/fix/45067-no-error…
Browse files Browse the repository at this point in the history
…-when-saving-same-tag

Fix no error when saving same tag name in X:Y format
  • Loading branch information
techievivek authored Aug 12, 2024
2 parents e7fe622 + 720ad1b commit 0980fcd
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/libs/PolicyUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ function getTagList(policyTagList: OnyxEntry<PolicyTagList>, tagIndex: number):
* Cleans up escaping of colons (used to create multi-level tags, e.g. "Parent: Child") in the tag name we receive from the backend
*/
function getCleanedTagName(tag: string) {
return tag?.replace(/\\{1,2}:/g, CONST.COLON);
return tag?.replace(/\\:/g, CONST.COLON);
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/pages/workspace/tags/WorkspaceCreateTagPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ function CreateTagPage({route, policyTags}: CreateTagPageProps) {
const validate = useCallback(
(values: FormOnyxValues<typeof ONYXKEYS.FORMS.WORKSPACE_TAG_FORM>) => {
const errors: FormInputErrors<typeof ONYXKEYS.FORMS.WORKSPACE_TAG_FORM> = {};
const tagName = values.tagName.trim();
const tagName = PolicyUtils.escapeTagName(values.tagName.trim());
const {tags} = PolicyUtils.getTagList(policyTags, 0);

if (!ValidationUtils.isRequiredFulfilled(tagName)) {
Expand Down

0 comments on commit 0980fcd

Please sign in to comment.