diff --git a/src/libs/IOUUtils.ts b/src/libs/IOUUtils.ts index 5f6d99332336..986fd165d2d7 100644 --- a/src/libs/IOUUtils.ts +++ b/src/libs/IOUUtils.ts @@ -141,7 +141,10 @@ function insertTagIntoTransactionTagsString(transactionTags: string, tag: string const tagArray = TransactionUtils.getTagArrayFromName(transactionTags); tagArray[tagIndex] = tag; - return tagArray.join(CONST.COLON).replace(/:*$/, ''); + return tagArray + .map((tagItem) => tagItem.trim()) + .filter((tagItem) => !!tagItem) + .join(CONST.COLON); } function isMovingTransactionFromTrackExpense(action?: IOUAction) {