From 3cc4ad6bffcda0178c9d605353b5ed3da117814c Mon Sep 17 00:00:00 2001 From: Liang Ding Date: Wed, 23 Nov 2022 17:00:51 +0800 Subject: [PATCH] =?UTF-8?q?:bug:=20=E6=96=87=E6=A1=A3=E6=A0=87=E9=A2=98?= =?UTF-8?q?=E4=BB=A5=E7=A9=BA=E6=A0=BC=E7=BB=93=E5=B0=BE=E6=97=B6=E5=AF=BC?= =?UTF-8?q?=E5=87=BA=20HTML=20=E6=8A=A5=E9=94=99=20Fix=20https://github.co?= =?UTF-8?q?m/siyuan-note/siyuan/issues/6686?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/src/protyle/export/index.ts | 3 ++- kernel/model/export.go | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/app/src/protyle/export/index.ts b/app/src/protyle/export/index.ts index c40f2f919..edbff9b9b 100644 --- a/app/src/protyle/export/index.ts +++ b/app/src/protyle/export/index.ts @@ -447,7 +447,8 @@ const getExportPath = (option: { type: string, id: string }, removeAssets?: bool } else if (option.type === "word") { url = "/api/export/exportDocx"; } - const savePath = result.filePaths[0].endsWith(response.data.rootTitle) ? result.filePaths[0] : path.join(result.filePaths[0], replaceLocalPath(response.data.rootTitle)); + let savePath = result.filePaths[0].endsWith(response.data.rootTitle) ? result.filePaths[0] : path.join(result.filePaths[0], replaceLocalPath(response.data.rootTitle)); + savePath = savePath.trim(); fetchPost(url, { id: option.id, pdf: option.type === "pdf", diff --git a/kernel/model/export.go b/kernel/model/export.go index de3e154fc..615531d70 100644 --- a/kernel/model/export.go +++ b/kernel/model/export.go @@ -244,6 +244,7 @@ func ExportMarkdownHTML(id, savePath string, docx bool) (name, dom string) { tree = exportTree(tree, true, true, false) name = path.Base(tree.HPath) name = util.FilterFileName(name) // 导出 PDF、HTML 和 Word 时未移除不支持的文件名符号 https://github.com/siyuan-note/siyuan/issues/5614 + savePath = strings.TrimSpace(savePath) if err := os.MkdirAll(savePath, 0755); nil != err { logging.LogErrorf("mkdir [%s] failed: %s", savePath, err) @@ -330,6 +331,7 @@ func ExportMarkdownHTML(id, savePath string, docx bool) (name, dom string) { } func ExportHTML(id, savePath string, pdf, keepFold bool) (name, dom string) { + savePath = strings.TrimSpace(savePath) tree, _ := loadTreeByBlockID(id) var headings []*ast.Node if pdf { // 导出 PDF 需要标记目录书签