From c57014c12e9d08549866fbfdf9275369362d63d5 Mon Sep 17 00:00:00 2001 From: Liang Ding Date: Mon, 30 May 2022 17:53:56 +0800 Subject: [PATCH] =?UTF-8?q?:art:=20=E6=94=B9=E8=BF=9B=20`=E7=BD=91?= =?UTF-8?q?=E7=BB=9C=E5=9B=BE=E7=89=87=E8=BD=AC=E6=8D=A2=E4=B8=BA=E6=9C=AC?= =?UTF-8?q?=E5=9C=B0=E5=9B=BE=E7=89=87`=20=E5=BE=AE=E4=BF=A1=E5=9B=BE?= =?UTF-8?q?=E7=89=87=E6=8B=89=E5=8F=96=20Fix=20https://github.com/siyuan-n?= =?UTF-8?q?ote/siyuan/issues/5052?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- kernel/model/assets.go | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/kernel/model/assets.go b/kernel/model/assets.go index e3d295251..3ecbaba7f 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)