Absolutise DocBase before trying to absolutise anything else relative to it.
This commit is contained in:
parent
17d17a1629
commit
b16fe0b8d4
1 changed files with 16 additions and 0 deletions
16
config.go
16
config.go
|
@ -92,6 +92,15 @@ func getConfig(filename string) (Config, error) {
|
||||||
return config, errors.New("Invalid DirectorySort value.")
|
return config, errors.New("Invalid DirectorySort value.")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Absolutise DocBase
|
||||||
|
if(!filepath.IsAbs(config.DocBase)) {
|
||||||
|
abs, err := filepath.Abs(config.DocBase)
|
||||||
|
if err != nil {
|
||||||
|
return config, err
|
||||||
|
}
|
||||||
|
config.DocBase = abs
|
||||||
|
}
|
||||||
|
|
||||||
// Absolutise CGI paths
|
// Absolutise CGI paths
|
||||||
for index, cgiPath := range config.CGIPaths {
|
for index, cgiPath := range config.CGIPaths {
|
||||||
if(!filepath.IsAbs(cgiPath)) {
|
if(!filepath.IsAbs(cgiPath)) {
|
||||||
|
@ -110,6 +119,13 @@ func getConfig(filename string) (Config, error) {
|
||||||
}
|
}
|
||||||
config.CGIPaths = cgiPaths
|
config.CGIPaths = cgiPaths
|
||||||
|
|
||||||
|
// Absolutise SCGI paths
|
||||||
|
for index, scgiPath := range config.SCGIPaths {
|
||||||
|
if(!filepath.IsAbs(scgiPath)) {
|
||||||
|
config.SCGIPaths[index] = filepath.Join(config.DocBase, scgiPath)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Validate redirects
|
// Validate redirects
|
||||||
for _, value := range config.TempRedirects {
|
for _, value := range config.TempRedirects {
|
||||||
if strings.Contains(value, "://") && !strings.HasPrefix(value, "gemini://") {
|
if strings.Contains(value, "://") && !strings.HasPrefix(value, "gemini://") {
|
||||||
|
|
Loading…
Reference in a new issue