This commit is contained in:
Daniel 2025-02-20 10:09:24 +08:00
parent 8019fd6a6e
commit ff1e29424d
No known key found for this signature in database
GPG key ID: 86211BA83DF03017

View file

@ -182,19 +182,17 @@ func NetAssets2LocalAssets(rootID string, onlyImg bool, originalURL string) (err
request.SetHeader("Referer", originalURL) // 改进浏览器剪藏扩展转换本地图片成功率 https://github.com/siyuan-note/siyuan/issues/7464
}
resp, reqErr := request.Get(u)
if nil != reqErr {
logging.LogErrorf("download network asset [%s] failed: %s", u, reqErr)
continue
}
if http.StatusForbidden == resp.StatusCode || http.StatusUnauthorized == resp.StatusCode {
forbiddenCount++
}
if strings.Contains(strings.ToLower(resp.GetContentType()), "text/html") {
// 忽略超链接网页 `Convert network assets to local` no longer process webpage https://github.com/siyuan-note/siyuan/issues/9965
continue
}
if nil != reqErr {
logging.LogErrorf("download network asset [%s] failed: %s", u, reqErr)
continue
}
if 200 != resp.StatusCode {
logging.LogErrorf("download network asset [%s] failed: %d", u, resp.StatusCode)
continue