Replace filename with path without the local dir (#56296) (#56309)

(cherry picked from commit d94af21cac)

Co-authored-by: Dimitris Sotirakis <dimitrios.sotirakis@grafana.com>
This commit is contained in:
Grot (@grafanabot)
2022-10-04 10:34:51 -04:00
committed by GitHub
co-authored by Dimitris Sotirakis
parent 19427f9797
commit 8741f7dedb
+3 -2
View File
@@ -268,8 +268,9 @@ func ListLocalFiles(dir string) ([]File, error) {
err := filepath.Walk(dir, func(path string, info os.FileInfo, err error) error {
if !info.IsDir() {
files = append(files, File{
FullPath: path,
PathTrimmed: info.Name(),
FullPath: path,
// Strip the dir name from the filepath
PathTrimmed: strings.ReplaceAll(path, dir, ""),
})
}
return nil