mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-02-28 05:32:52 +00:00
🎨 导入 Markdown 时支持图片路径包含空格 Fix https://github.com/siyuan-note/siyuan/issues/6688
This commit is contained in:
@@ -450,6 +450,7 @@ func parseStdMd(markdown []byte) (ret *parse.Tree) {
|
||||
luteEngine.SetSetext(false)
|
||||
luteEngine.SetYamlFrontMatter(false)
|
||||
luteEngine.SetLinkRef(false)
|
||||
luteEngine.SetImgPathAllowSpace(true)
|
||||
ret = parse.Parse("", markdown, luteEngine.ParseOptions)
|
||||
genTreeID(ret)
|
||||
return
|
||||
|
||||
@@ -518,7 +518,14 @@ func ImportFromLocalPath(boxID, localPath string, toPath string) (err error) {
|
||||
return ast.WalkContinue
|
||||
}
|
||||
|
||||
if !util.IsRelativePath(dest) || "" == dest {
|
||||
dest = strings.ReplaceAll(dest, "%20", " ")
|
||||
dest = strings.ReplaceAll(dest, "%5C", "/")
|
||||
n.Tokens = []byte(dest)
|
||||
if !util.IsRelativePath(dest) {
|
||||
return ast.WalkContinue
|
||||
}
|
||||
dest = filepath.ToSlash(dest)
|
||||
if "" == dest {
|
||||
return ast.WalkContinue
|
||||
}
|
||||
|
||||
@@ -611,10 +618,12 @@ func ImportFromLocalPath(boxID, localPath string, toPath string) (err error) {
|
||||
return ast.WalkContinue
|
||||
}
|
||||
|
||||
dest = strings.ReplaceAll(dest, "%20", " ")
|
||||
dest = strings.ReplaceAll(dest, "%5C", "/")
|
||||
n.Tokens = []byte(dest)
|
||||
if !util.IsRelativePath(dest) {
|
||||
return ast.WalkContinue
|
||||
}
|
||||
|
||||
dest = filepath.ToSlash(dest)
|
||||
if "" == dest {
|
||||
return ast.WalkContinue
|
||||
|
||||
Reference in New Issue
Block a user