Skip to content

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

:art: 改进 `网络图片转换为本地图片` 微信图片拉取 Fix https://github.com/siyuan-note/siyuan/issues/5052

Liang Dingc57014c12e9d
diff --git a/kernel/model/assets.go b/kernel/model/assets.go
index e3d2952519..3ecbaba7f4 100644
--- a/kernel/model/assets.go
+++ b/kernel/model/assets.go
@@ -77,6 +77,17 @@ func NetImg2LocalAssets(rootID string) (err error) {
dest := linkDest.Tokens
if !sql.IsAssetLinkDest(dest) && (bytes.HasPrefix(bytes.ToLower(dest), []byte("https://")) || bytes.HasPrefix(bytes.ToLower(dest), []byte("http://"))) {
u := string(dest)
+ if strings.Contains(u, "qpic.cn") {
+ // 微信图片拉取改进 https://github.com/siyuan-note/siyuan/issues/5052
+ if strings.Contains(u, "http://") {
+ u = strings.Replace(u, "http://", "https://", 1)
+ }
+ if strings.HasSuffix(u, "/0") {
+ u = strings.Replace(u, "/0", "/640", 1)
+ } else if strings.Contains(u, "/0?") {
+ u = strings.Replace(u, "/0?", "/640?", 1)
+ }
+ }
util.PushMsg(fmt.Sprintf(Conf.Language(119), u), 15000)
request := util.NewBrowserRequest(Conf.System.NetworkProxy.String())
resp, reqErr := request.Get(u)