This commit is contained in:
Daniel 2024-07-04 23:11:56 +08:00
parent d99931b71a
commit 3073be676d
No known key found for this signature in database
GPG key ID: 86211BA83DF03017
2 changed files with 11 additions and 0 deletions

View file

@ -53,6 +53,9 @@ func statAsset(c *gin.Context) {
} else if strings.HasPrefix(path, "file://") {
p = strings.TrimPrefix(path, "file://")
if strings.Contains(p, ":") {
p = strings.TrimPrefix(p, "/")
}
} else {
ret.Code = 1
return

View file

@ -125,6 +125,10 @@ func NetImg2LocalAssets(rootID, originalURL string) (err error) {
// `Convert network images/assets to local` supports URL-encoded local file names https://github.com/siyuan-note/siyuan/issues/9929
u = unescaped
}
if strings.Contains(u, ":") {
u = strings.TrimPrefix(u, "/")
}
if !gulu.File.IsExist(u) || gulu.File.IsDir(u) {
return ast.WalkSkipChildren
}
@ -299,6 +303,10 @@ func NetAssets2LocalAssets(rootID string) (err error) {
// `Convert network images/assets to local` supports URL-encoded local file names https://github.com/siyuan-note/siyuan/issues/9929
u = unescaped
}
if strings.Contains(u, ":") {
u = strings.TrimPrefix(u, "/")
}
if !gulu.File.IsExist(u) || gulu.File.IsDir(u) {
return ast.WalkContinue
}