Skip to content

Commit

Permalink
fix: empty cate error
Browse files Browse the repository at this point in the history
  • Loading branch information
terwer committed Mar 11, 2024
1 parent f753061 commit 5555ce7
Show file tree
Hide file tree
Showing 7 changed files with 378 additions and 170 deletions.
6 changes: 6 additions & 0 deletions libs/zhi-blog-api/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# zhi-blog-api

## 1.56.2

### Patch Changes

- fix: empty cate error

## 1.56.1

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion libs/zhi-blog-api/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "zhi-blog-api",
"version": "1.56.1",
"version": "1.56.2",
"type": "module",
"description": "a common blog interface",
"main": "./dist/index.js",
Expand Down
5 changes: 4 additions & 1 deletion libs/zhi-blog-api/src/lib/PostUtil.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,10 @@ class PostUtil {
// 分类合并
if (yamlObj?.categories && yamlObj.categories.length > 0) {
const combinedCategories = [
...new Set([...post.categories.map((cate) => cate.trim()), ...yamlObj.categories.map((cate) => cate.trim())]),
...new Set([
...(post?.categories ?? []).map((cate) => cate.trim()),
...yamlObj.categories.map((cate) => cate.trim()),
]),
].filter((cate) => cate.trim() !== "")

post.categories = combinedCategories.length > 0 ? combinedCategories : []
Expand Down
7 changes: 7 additions & 0 deletions libs/zhi-siyuan-api/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# zhi-siyuan-api

## 2.18.6

### Patch Changes

- Updated dependencies
- zhi-blog-api@1.56.2

## 2.18.5

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion libs/zhi-siyuan-api/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "zhi-siyuan-api",
"version": "2.18.5",
"version": "2.18.6",
"type": "module",
"description": "a siyuan-note api including both kernel and client",
"main": "./dist/index.js",
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@
"@changesets/cli": "^2.27.1",
"@terwer/commit-config-custom": "workspace:*",
"@terwer/eslint-config-custom": "workspace:*",
"turbo": "^1.12.4"
"turbo": "^1.12.5"
}
}
Loading

0 comments on commit 5555ce7

Please sign in to comment.