Skip to content

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

:art: Improve net assets to local assets https://github.com/siyuan-note/siyuan/issues/11885

Daniel3073be676d06
diff --git a/kernel/api/asset.go b/kernel/api/asset.go
index 08b11f5e14..d4c0790190 100644
--- a/kernel/api/asset.go
+++ b/kernel/api/asset.go
@@ -53,6 +53,9 @@ func statAsset(c *gin.Context) {
} else if strings.HasPrefix(path, "file://") {
p = strings.TrimPrefix(path, "file://")
+ if strings.Contains(p, ":") {
+ p = strings.TrimPrefix(p, "/")
+ }
} else {
ret.Code = 1
return
diff --git a/kernel/model/assets.go b/kernel/model/assets.go
index ed51afd728..19a8cab042 100644
--- a/kernel/model/assets.go
+++ b/kernel/model/assets.go
@@ -125,6 +125,10 @@ func NetImg2LocalAssets(rootID, originalURL string) (err error) {
// `Convert network images/assets to local` supports URL-encoded local file names https://github.com/siyuan-note/siyuan/issues/9929
u = unescaped
}
+ if strings.Contains(u, ":") {
+ u = strings.TrimPrefix(u, "/")
+ }
+
if !gulu.File.IsExist(u) || gulu.File.IsDir(u) {
return ast.WalkSkipChildren
}
@@ -299,6 +303,10 @@ func NetAssets2LocalAssets(rootID string) (err error) {
// `Convert network images/assets to local` supports URL-encoded local file names https://github.com/siyuan-note/siyuan/issues/9929
u = unescaped
}
+ if strings.Contains(u, ":") {
+ u = strings.TrimPrefix(u, "/")
+ }
+
if !gulu.File.IsExist(u) || gulu.File.IsDir(u) {
return ast.WalkContinue
}