🎨 改进 网络图片转换为本地图片
微信图片拉取 Fix https://github.com/siyuan-note/siyuan/issues/5052
This commit is contained in:
parent
978c2c9386
commit
c57014c12e
1 changed files with 11 additions and 0 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Reference in a new issue