1
1
Fork 0
mirror of https://tildegit.org/solderpunk/molly-brown synced 2024-04-28 19:05:03 +02:00

Absolutise DocBase before trying to absolutise anything else relative to it.

This commit is contained in:
Solderpunk 2023-02-08 20:32:17 +01:00
parent 17d17a1629
commit b16fe0b8d4

View File

@ -92,6 +92,15 @@ func getConfig(filename string) (Config, error) {
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
for index, cgiPath := range config.CGIPaths {
if(!filepath.IsAbs(cgiPath)) {
@ -110,6 +119,13 @@ func getConfig(filename string) (Config, error) {
}
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
for _, value := range config.TempRedirects {
if strings.Contains(value, "://") && !strings.HasPrefix(value, "gemini://") {