From cc2bb44e0a86f92a492869d2650990a695fbc23e Mon Sep 17 00:00:00 2001 From: terwer Date: Sat, 4 Nov 2023 20:06:42 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20#855=20=E8=87=AA=E5=8A=A8=E6=98=A0?= =?UTF-8?q?=E5=B0=84=E5=88=86=E7=B1=BB=E6=97=B6=E6=89=8D=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E8=B7=AF=E5=BE=84=E4=B8=BA=E5=88=86=E7=B1=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/adaptors/base/baseExtendApi.ts | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/adaptors/base/baseExtendApi.ts b/src/adaptors/base/baseExtendApi.ts index d40a5226..ba0a32f0 100644 --- a/src/adaptors/base/baseExtendApi.ts +++ b/src/adaptors/base/baseExtendApi.ts @@ -249,16 +249,18 @@ class BaseExtendApi extends WebApi implements IBlogApi, IWebApi { // 自动映射分类 const autoDir = path.join(savePath.replace(CATE_AUTO_NAME, ""), save_dir) post.cate_slugs = [autoDir] - } - // 笔记层级作为分类 - const docPathArray = save_dir.split("/") - if (docPathArray.length > 1) { - for (let i = 1; i < docPathArray.length; i++) { - const docCate = HtmlUtil.removeTitleNumber(docPathArray[i]) - pathCates.push(docCate) + + // 笔记层级作为分类 + const docPathArray = save_dir.split("/") + if (docPathArray.length > 1) { + for (let i = 1; i < docPathArray.length; i++) { + const docCate = HtmlUtil.removeTitleNumber(docPathArray[i]) + pathCates.push(docCate) + } } } + // 目录分类 this.logger.info("目录路径转换的分类 =>", pathCates) const mergedCategories = [...new Set([...(pathCates ?? []), ...(post?.categories ?? [])])].filter(