From d34caba3bbfe470660ddf753f7c2cf66ee60e5ee Mon Sep 17 00:00:00 2001 From: Daniel <845765@qq.com> Date: Tue, 24 Dec 2024 16:33:24 +0800 Subject: [PATCH] :art: Improve net img convert to local https://github.com/siyuan-note/siyuan/issues/13600 --- kernel/api/asset.go | 3 +++ kernel/model/assets.go | 3 +++ 2 files changed, 6 insertions(+) diff --git a/kernel/api/asset.go b/kernel/api/asset.go index f99cbfbf6..cb5bd4e55 100644 --- a/kernel/api/asset.go +++ b/kernel/api/asset.go @@ -57,6 +57,9 @@ func statAsset(c *gin.Context) { if strings.Contains(p, ":") { p = strings.TrimPrefix(p, "/") } + if strings.Contains(p, "?") { + p = p[:strings.Index(p, "?")] + } } else { ret.Code = 1 return diff --git a/kernel/model/assets.go b/kernel/model/assets.go index 179c71f6f..c89d3e54f 100644 --- a/kernel/model/assets.go +++ b/kernel/model/assets.go @@ -116,6 +116,9 @@ func NetAssets2LocalAssets(rootID string, onlyImg bool, originalURL string) (err if strings.Contains(u, ":") { u = strings.TrimPrefix(u, "/") } + if strings.Contains(u, "?") { + u = u[:strings.Index(u, "?")] + } if !gulu.File.IsExist(u) || gulu.File.IsDir(u) { continue