mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-05-05 03:50:52 +08:00
🐛 文档标题以空格结尾时导出 HTML 报错 Fix https://github.com/siyuan-note/siyuan/issues/6686
This commit is contained in:
parent
fdd9973d24
commit
3cc4ad6bff
@ -447,7 +447,8 @@ const getExportPath = (option: { type: string, id: string }, removeAssets?: bool
|
|||||||
} else if (option.type === "word") {
|
} else if (option.type === "word") {
|
||||||
url = "/api/export/exportDocx";
|
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, {
|
fetchPost(url, {
|
||||||
id: option.id,
|
id: option.id,
|
||||||
pdf: option.type === "pdf",
|
pdf: option.type === "pdf",
|
||||||
|
@ -244,6 +244,7 @@ func ExportMarkdownHTML(id, savePath string, docx bool) (name, dom string) {
|
|||||||
tree = exportTree(tree, true, true, false)
|
tree = exportTree(tree, true, true, false)
|
||||||
name = path.Base(tree.HPath)
|
name = path.Base(tree.HPath)
|
||||||
name = util.FilterFileName(name) // 导出 PDF、HTML 和 Word 时未移除不支持的文件名符号 https://github.com/siyuan-note/siyuan/issues/5614
|
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 {
|
if err := os.MkdirAll(savePath, 0755); nil != err {
|
||||||
logging.LogErrorf("mkdir [%s] failed: %s", savePath, 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) {
|
func ExportHTML(id, savePath string, pdf, keepFold bool) (name, dom string) {
|
||||||
|
savePath = strings.TrimSpace(savePath)
|
||||||
tree, _ := loadTreeByBlockID(id)
|
tree, _ := loadTreeByBlockID(id)
|
||||||
var headings []*ast.Node
|
var headings []*ast.Node
|
||||||
if pdf { // 导出 PDF 需要标记目录书签
|
if pdf { // 导出 PDF 需要标记目录书签
|
||||||
|
Loading…
Reference in New Issue
Block a user