mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-29 21:08:49 +01:00
🎨 改进 网络图片转换为本地图片 微信图片拉取 Fix https://github.com/siyuan-note/siyuan/issues/6431
This commit is contained in:
parent
f02fd1ed93
commit
85aa7ac6fe
1 changed files with 9 additions and 6 deletions
|
|
@ -95,15 +95,18 @@ func NetImg2LocalAssets(rootID string) (err error) {
|
|||
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
|
||||
// 改进 `网络图片转换为本地图片` 微信图片拉取 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)
|
||||
}
|
||||
|
||||
// 改进 `网络图片转换为本地图片` 微信图片拉取 https://github.com/siyuan-note/siyuan/issues/6431
|
||||
// 下面这部分需要注释掉,否则会导致响应 400
|
||||
//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.PushUpdateMsg(msgId, fmt.Sprintf(Conf.Language(119), u), 15000)
|
||||
request := httpclient.NewBrowserRequest()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue