mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-09-22 00:20:47 +02:00
🔒 Disable HTTP access to the /assets/ path https://github.com/siyuan-note/siyuan/issues/15257
This commit is contained in:
parent
42b92bf7a2
commit
31f5797176
1 changed files with 6 additions and 0 deletions
|
@ -475,6 +475,12 @@ func serveAssets(ginServer *gin.Engine) {
|
|||
|
||||
ginServer.GET("/assets/*path", model.CheckAuth, func(context *gin.Context) {
|
||||
requestPath := context.Param("path")
|
||||
if "/" == requestPath || "" == requestPath {
|
||||
// 禁止访问根目录 Disable HTTP access to the /assets/ path https://github.com/siyuan-note/siyuan/issues/15257
|
||||
context.Status(http.StatusForbidden)
|
||||
return
|
||||
}
|
||||
|
||||
relativePath := path.Join("assets", requestPath)
|
||||
p, err := model.GetAssetAbsPath(relativePath)
|
||||
if err != nil {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue