diff --git a/packages/loot-core/src/server/main.ts b/packages/loot-core/src/server/main.ts index d24ca17befe..9abfd5cd964 100644 --- a/packages/loot-core/src/server/main.ts +++ b/packages/loot-core/src/server/main.ts @@ -280,7 +280,7 @@ handlers['category-create'] = mutator(async function ({ } return db.insertCategory({ - name, + name: name.trim(), cat_group: groupId, is_income: isIncome ? 1 : 0, hidden: hidden ? 1 : 0, @@ -291,7 +291,10 @@ handlers['category-create'] = mutator(async function ({ handlers['category-update'] = mutator(async function (category) { return withUndo(async () => { try { - await db.updateCategory(category); + await db.updateCategory({ + ...category, + name: category.name.trim(), + }); } catch (e) { if (e.message.toLowerCase().includes('unique constraint')) { return { error: { type: 'category-exists' } }; diff --git a/upcoming-release-notes/3495.md b/upcoming-release-notes/3495.md new file mode 100644 index 00000000000..b4ddc5cd82d --- /dev/null +++ b/upcoming-release-notes/3495.md @@ -0,0 +1,6 @@ +--- +category: Bugfix +authors: [junyuanz1] +--- + +Removes whitespace from both ends of the category name