🔒 Disable HTTP access to the /assets/ path https://github.com/siyuan-note/siyuan/issues/15257

This commit is contained in:
Daniel 2025-07-09 20:12:54 +08:00
parent 42b92bf7a2
commit 31f5797176
No known key found for this signature in database
GPG key ID: 86211BA83DF03017

View file

@ -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 {