Skip to content
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

Fix no error when saving same tag name in X:Y format #46556

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading