Skip to content

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

:art: `Convert network images to local` supports `//` https://github.com/siyuan-note/siyuan/issues/10598

Daniel8d290fb8a880
diff --git a/kernel/model/assets.go b/kernel/model/assets.go
index fd8752c3ed..fdf2c51bc5 100644
--- a/kernel/model/assets.go
+++ b/kernel/model/assets.go
@@ -148,7 +148,12 @@ func NetImg2LocalAssets(rootID, originalURL string) (err error) {
return ast.WalkSkipChildren
}
- if bytes.HasPrefix(bytes.ToLower(dest), []byte("https://")) || bytes.HasPrefix(bytes.ToLower(dest), []byte("http://")) {
+ if bytes.HasPrefix(bytes.ToLower(dest), []byte("https://")) || bytes.HasPrefix(bytes.ToLower(dest), []byte("http://")) || bytes.HasPrefix(dest, []byte("//")) {
+ if bytes.HasPrefix(dest, []byte("//")) {
+ // `Convert network images to local` supports `//` https://github.com/siyuan-note/siyuan/issues/10598
+ dest = append([]byte("https:"), dest...)
+ }
+
u := string(dest)
if strings.Contains(u, "qpic.cn") {
// 改进 `网络图片转换为本地图片` 微信图片拉取 https://github.com/siyuan-note/siyuan/issues/5052
@@ -320,7 +325,12 @@ func NetAssets2LocalAssets(rootID string) (err error) {
return ast.WalkContinue
}
- if bytes.HasPrefix(bytes.ToLower(dest), []byte("https://")) || bytes.HasPrefix(bytes.ToLower(dest), []byte("http://")) {
+ if bytes.HasPrefix(bytes.ToLower(dest), []byte("https://")) || bytes.HasPrefix(bytes.ToLower(dest), []byte("http://")) || bytes.HasPrefix(dest, []byte("//")) {
+ if bytes.HasPrefix(dest, []byte("//")) {
+ // `Convert network images to local` supports `//` https://github.com/siyuan-note/siyuan/issues/10598
+ dest = append([]byte("https:"), dest...)
+ }
+
u := string(dest)
if strings.Contains(u, "qpic.cn") {
// 改进 `网络图片转换为本地图片` 微信图片拉取 https://github.com/siyuan-note/siyuan/issues/5052