Skip to content

An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作

:art: `Convert network images/assets to local` supports URL-encoded local file names https://github.com/siyuan-note/siyuan/issues/9929

Danielbe18e6c5608b
diff --git a/kernel/api/lute.go b/kernel/api/lute.go
index 73f883dfca..34d0feaf7c 100644
--- a/kernel/api/lute.go
+++ b/kernel/api/lute.go
@@ -17,8 +17,8 @@
package api
import (
- "github.com/siyuan-note/siyuan/kernel/treenode"
"net/http"
+ "net/url"
"path/filepath"
"strings"
@@ -30,6 +30,7 @@ import (
"github.com/siyuan-note/filelock"
"github.com/siyuan-note/logging"
"github.com/siyuan-note/siyuan/kernel/model"
+ "github.com/siyuan-note/siyuan/kernel/treenode"
"github.com/siyuan-note/siyuan/kernel/util"
)
@@ -131,6 +132,12 @@ func html2BlockDOM(c *gin.Context) {
localPath = strings.TrimPrefix(localPath, "/")
}
+ unescaped, _ := url.PathUnescape(localPath)
+ if unescaped != localPath {
+ // `Convert network images/assets to local` supports URL-encoded local file names https://github.com/siyuan-note/siyuan/issues/9929
+ localPath = unescaped
+ }
+
if !filepath.IsAbs(localPath) {
// Kernel crash when copy-pasting from some browsers https://github.com/siyuan-note/siyuan/issues/9203
return ast.WalkContinue