Commit 2bd4c14e by bergquist

make path absolute before following symlink

parent 47d38843
......@@ -47,20 +47,21 @@ func NewDashboardFileReader(cfg *DashboardsAsConfig, log log.Logger) (*fileReade
log.Error("Cannot read directory", "error", err)
}
path, err := filepath.EvalSymlinks(path)
copy := path
path, err := filepath.Abs(path)
if err != nil {
log.Error("Failed to read content of symlinked path: %s", path)
log.Error("Could not create absolute path ", "path", path)
path = copy //if .Abs return an error we fallback to path
}
absPath, err := filepath.Abs(path)
path, err = filepath.EvalSymlinks(path)
if err != nil {
log.Error("Could not create absolute path ", "path", path)
absPath = path //if .Abs return an error we fallback to path
log.Error("Failed to read content of symlinked path: %s", path)
}
return &fileReader{
Cfg: cfg,
Path: absPath,
Path: path,
log: log,
dashboardService: dashboards.NewProvisioningService(),
}, nil
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment