From ee49bf61fbee8e7f2595f1a14466204647c0aca4 Mon Sep 17 00:00:00 2001 From: Fitsum Abebe Date: Wed, 15 Nov 2023 20:38:42 +0300 Subject: [PATCH 1/4] added code to remove escaping backslash from tag --- src/libs/OptionsListUtils.js | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/src/libs/OptionsListUtils.js b/src/libs/OptionsListUtils.js index 123efb28bf19..ba6c5076a425 100644 --- a/src/libs/OptionsListUtils.js +++ b/src/libs/OptionsListUtils.js @@ -895,13 +895,18 @@ function getCategoryListSections(categories, recentlyUsedCategories, selectedOpt * @returns {Array} */ function getTagsOptions(tags) { - return _.map(tags, (tag) => ({ - text: tag.name, - keyForList: tag.name, - searchText: tag.name, - tooltipText: tag.name, - isDisabled: !tag.enabled, - })); + return _.map(tags, (tag) => { + // This is to remove unnecessary escaping backslash in tag name sent from backend. + const tagName = (tag.name || '').replace(/(\\)+/g, ''); + + return { + text: tagName, + keyForList: tagName, + searchText: tagName, + tooltipText: tagName, + isDisabled: !tag.enabled, + }; + }); } /** From 200aa25ea8679ca56f074a9769f2f8e9fc0d64b5 Mon Sep 17 00:00:00 2001 From: Fitsum Abebe Date: Fri, 17 Nov 2023 19:36:09 +0300 Subject: [PATCH 2/4] added null checker --- src/libs/OptionsListUtils.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libs/OptionsListUtils.js b/src/libs/OptionsListUtils.js index ba6c5076a425..c793f3b43567 100644 --- a/src/libs/OptionsListUtils.js +++ b/src/libs/OptionsListUtils.js @@ -897,7 +897,7 @@ function getCategoryListSections(categories, recentlyUsedCategories, selectedOpt function getTagsOptions(tags) { return _.map(tags, (tag) => { // This is to remove unnecessary escaping backslash in tag name sent from backend. - const tagName = (tag.name || '').replace(/(\\)+/g, ''); + const tagName = tag?.name?.replace(/(\\)+/g, ''); return { text: tagName, From ebfbc79eebcb19f081bc21211f90ad0df1de95ec Mon Sep 17 00:00:00 2001 From: Fitsum Abebe Date: Fri, 17 Nov 2023 21:18:19 +0300 Subject: [PATCH 3/4] removed optional chaining --- src/libs/OptionsListUtils.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libs/OptionsListUtils.js b/src/libs/OptionsListUtils.js index c793f3b43567..17a21e003afb 100644 --- a/src/libs/OptionsListUtils.js +++ b/src/libs/OptionsListUtils.js @@ -897,7 +897,7 @@ function getCategoryListSections(categories, recentlyUsedCategories, selectedOpt function getTagsOptions(tags) { return _.map(tags, (tag) => { // This is to remove unnecessary escaping backslash in tag name sent from backend. - const tagName = tag?.name?.replace(/(\\)+/g, ''); + const tagName = tag.name && tag.name.replace(/(\\)+/g, ''); return { text: tagName, From 7de5d9f5252dd1bb34cea3f3323b5549071dd5d0 Mon Sep 17 00:00:00 2001 From: Fitsum Abebe Date: Mon, 20 Nov 2023 18:08:46 +0300 Subject: [PATCH 4/4] updated to remove esc only if it is before colon --- src/libs/OptionsListUtils.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libs/OptionsListUtils.js b/src/libs/OptionsListUtils.js index 17a21e003afb..79eb88154b37 100644 --- a/src/libs/OptionsListUtils.js +++ b/src/libs/OptionsListUtils.js @@ -897,7 +897,7 @@ function getCategoryListSections(categories, recentlyUsedCategories, selectedOpt function getTagsOptions(tags) { return _.map(tags, (tag) => { // This is to remove unnecessary escaping backslash in tag name sent from backend. - const tagName = tag.name && tag.name.replace(/(\\)+/g, ''); + const tagName = tag.name && tag.name.replace(/\\{1,2}:/g, ':'); return { text: tagName,