Merge remote-tracking branch 'origin/dev' into dev
This commit is contained in:
commit
5f1999d68e
1 changed files with 12 additions and 2 deletions
|
@ -393,8 +393,18 @@ func serveAssets(ginServer *gin.Engine) {
|
|||
relativePath := path.Join("assets", requestPath)
|
||||
p, err := model.GetAssetAbsPath(relativePath)
|
||||
if nil != err {
|
||||
context.Status(http.StatusNotFound)
|
||||
return
|
||||
if strings.Contains(strings.TrimPrefix(requestPath, "/"), "/") {
|
||||
// 再使用编码过的路径解析一次 https://github.com/siyuan-note/siyuan/issues/11823
|
||||
dest := url.PathEscape(strings.TrimPrefix(requestPath, "/"))
|
||||
dest = strings.ReplaceAll(dest, ":", "%3A")
|
||||
relativePath = path.Join("assets", dest)
|
||||
p, err = model.GetAssetAbsPath(relativePath)
|
||||
}
|
||||
|
||||
if nil != err {
|
||||
context.Status(http.StatusNotFound)
|
||||
return
|
||||
}
|
||||
}
|
||||
http.ServeFile(context.Writer, context.Request, p)
|
||||
return
|
||||
|
|
Loading…
Add table
Reference in a new issue