Skip to content

Commit

Permalink
Fix issue #3252 remove extra space from category name (#3495)
Browse files Browse the repository at this point in the history
* Fix issue #3252 remove extra space from category name

* add md file

* rename
  • Loading branch information
junyuanz1 authored Sep 25, 2024
1 parent 88a7432 commit 3a9a929
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
7 changes: 5 additions & 2 deletions packages/loot-core/src/server/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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' } };
Expand Down
6 changes: 6 additions & 0 deletions upcoming-release-notes/3495.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
category: Bugfix
authors: [junyuanz1]
---

Removes whitespace from both ends of the category name

0 comments on commit 3a9a929

Please sign in to comment.