mirror of
https://github.com/grafana/grafana.git
synced 2025-02-10 23:55:47 -06:00
provisioning: turn relative symlinked path into absolut paths
This commit is contained in:
parent
f606654c50
commit
d089b5e05d
@ -48,16 +48,25 @@ func NewDashboardFileReader(cfg *DashboardsAsConfig, log log.Logger) (*fileReade
|
||||
}
|
||||
|
||||
copy := path
|
||||
|
||||
// get absolut path of config file
|
||||
path, err := filepath.Abs(path)
|
||||
if err != nil {
|
||||
log.Error("Could not create absolute path ", "path", path)
|
||||
}
|
||||
|
||||
// follow the symlink to get the real path
|
||||
path, err = filepath.EvalSymlinks(path)
|
||||
if err != nil {
|
||||
log.Error("Failed to read content of symlinked path: %s", path)
|
||||
}
|
||||
|
||||
// get the absolut path in case the symlink is relative
|
||||
path, err = filepath.Abs(path)
|
||||
if err != nil {
|
||||
log.Error("Could not create absolute path ", "path", path)
|
||||
}
|
||||
|
||||
if path == "" {
|
||||
path = copy
|
||||
log.Info("falling back to original path due to EvalSymlink/Abs failure")
|
||||
|
Loading…
Reference in New Issue
Block a user