🎨 导入 Markdown 时支持图片路径包含空格 Fix https://github.com/siyuan-note/siyuan/issues/6688

This commit is contained in:
Liang Ding 2022-11-24 18:07:36 +08:00
parent 70e144d72a
commit bf0b9df04f
No known key found for this signature in database
GPG key ID: 136F30F901A2231D
2 changed files with 12 additions and 2 deletions

View file

@ -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