mirror of
https://github.com/0xJacky/nginx-ui.git
synced 2025-05-11 10:25:52 +02:00
enhance: clean filepath
This commit is contained in:
parent
46a9ccbdf1
commit
abd76ff930
2 changed files with 8 additions and 2 deletions
|
@ -1,6 +1,7 @@
|
|||
package nginx
|
||||
|
||||
import (
|
||||
"github.com/0xJacky/Nginx-UI/internal/helper"
|
||||
"github.com/0xJacky/Nginx-UI/internal/logger"
|
||||
"github.com/0xJacky/Nginx-UI/settings"
|
||||
"os/exec"
|
||||
|
@ -31,7 +32,13 @@ func GetConfPath(dir ...string) (confPath string) {
|
|||
confPath = settings.NginxSettings.ConfigDir
|
||||
}
|
||||
|
||||
return filepath.Join(confPath, filepath.Join(dir...))
|
||||
joined := filepath.Clean(filepath.Join(confPath, filepath.Join(dir...)))
|
||||
|
||||
if !helper.IsUnderDirectory(confPath, joined) {
|
||||
return confPath
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
func GetPIDPath() (path string) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue