core: Implement FastAbs to avoid repeated os.Getwd calls (#6687)

* core: Implement FastAbs to avoid repeated os.Getwd calls

* Lint

* Rename files
This commit is contained in:
Francis Lavoie
2024-11-13 03:55:51 -05:00
committed by GitHub
parent 238f1108e6
commit 315715e90f
10 changed files with 90 additions and 16 deletions

View File

@ -228,7 +228,7 @@ func (t Transport) buildEnv(r *http.Request) (envVars, error) {
ip = strings.Replace(ip, "]", "", 1)
// make sure file root is absolute
root, err := filepath.Abs(repl.ReplaceAll(t.Root, "."))
root, err := caddy.FastAbs(repl.ReplaceAll(t.Root, "."))
if err != nil {
return nil, err
}