From f1813ae3a3a2c0cc6583660534f3c61d0175af23 Mon Sep 17 00:00:00 2001 From: stobin Date: Wed, 17 Jan 2018 14:47:44 +0000 Subject: [PATCH] Make file_reader follow symlinks --- pkg/services/provisioning/dashboards/file_reader.go | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/pkg/services/provisioning/dashboards/file_reader.go b/pkg/services/provisioning/dashboards/file_reader.go index c3329e07488..d553f712f7a 100644 --- a/pkg/services/provisioning/dashboards/file_reader.go +++ b/pkg/services/provisioning/dashboards/file_reader.go @@ -145,6 +145,17 @@ func createWalkFn(fr *fileReader, folderId int64) filepath.WalkFunc { return nil } + checkFilepath, err := filepath.EvalSymlinks(path) + + if path != checkFilepath { + path = checkFilepath + fi, err := os.Lstat(checkFilepath) + if err != nil { + return err + } + fileInfo = fi + } + cachedDashboard, exist := fr.cache.getCache(path) if exist && cachedDashboard.UpdatedAt == fileInfo.ModTime() { return nil