File tree Expand file tree Collapse file tree 2 files changed +8
-2
lines changed Expand file tree Collapse file tree 2 files changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -18,7 +18,6 @@ func GetConfigs(c *gin.Context) {
1818 dir := c .DefaultQuery ("dir" , "/" )
1919
2020 configFiles , err := os .ReadDir (nginx .GetConfPath (dir ))
21-
2221 if err != nil {
2322 api .ErrHandler (c , err )
2423 return
Original file line number Diff line number Diff line change 11package nginx
22
33import (
4+ "github.com/0xJacky/Nginx-UI/internal/helper"
45 "github.com/0xJacky/Nginx-UI/internal/logger"
56 "github.com/0xJacky/Nginx-UI/settings"
67 "os/exec"
@@ -31,7 +32,13 @@ func GetConfPath(dir ...string) (confPath string) {
3132 confPath = settings .NginxSettings .ConfigDir
3233 }
3334
34- return filepath .Join (confPath , filepath .Join (dir ... ))
35+ joined := filepath .Clean (filepath .Join (confPath , filepath .Join (dir ... )))
36+
37+ if ! helper .IsUnderDirectory (confPath , joined ) {
38+ return confPath
39+ }
40+
41+ return
3542}
3643
3744func GetPIDPath () (path string ) {
You can’t perform that action at this time.
0 commit comments