Fix issue #3252 remove extra space from category name (#3495)

* Fix issue #3252 remove extra space from category name

* add md file

* rename
This commit is contained in:
Junyuan Zheng
2024-09-25 13:35:37 -07:00
committed by GitHub
parent 88a7432975
commit 3a9a929f56
2 changed files with 11 additions and 2 deletions

View File

@@ -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' } };

View File

@@ -0,0 +1,6 @@
---
category: Bugfix
authors: [junyuanz1]
---
Removes whitespace from both ends of the category name