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 issue #3252 remove extra space from category name #3495

Merged
merged 3 commits into from
Sep 25, 2024
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
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
Loading