From 7c2d6f302bb6e40c1d3bd0f93996677011e0e80d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philipp=20H=C3=A4felfinger?= Date: Thu, 16 Apr 2020 00:18:56 +0200 Subject: [PATCH] fixes name of the filesystem entry --- .../pkg/localFileStructure/ScanLocalFileStructure_test.go | 4 ++-- internal/pkg/localFileStructure/filesystemScanner.go | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/internal/pkg/localFileStructure/ScanLocalFileStructure_test.go b/internal/pkg/localFileStructure/ScanLocalFileStructure_test.go index 913b586..5026944 100644 --- a/internal/pkg/localFileStructure/ScanLocalFileStructure_test.go +++ b/internal/pkg/localFileStructure/ScanLocalFileStructure_test.go @@ -46,7 +46,7 @@ func Test_ScanLocalFileStructure_should_find_testfile_with_trimmed_folder(t *tes } containsTestImage := false - containsFolder := true + containsFolder := false for _, img := range images { if img.Name == "testimage.jpg" && img.Key == "root/testimage.jpg" && !img.IsDir { containsTestImage = true @@ -61,7 +61,7 @@ func Test_ScanLocalFileStructure_should_find_testfile_with_trimmed_folder(t *tes t.Errorf("Did not find the expected testimage.") } if !containsFolder { - t.Errorf("Did not find the expected test folder.") + t.Errorf("There should be a virtual 'root' folder present.") } } diff --git a/internal/pkg/localFileStructure/filesystemScanner.go b/internal/pkg/localFileStructure/filesystemScanner.go index d59a5f5..eca6617 100644 --- a/internal/pkg/localFileStructure/filesystemScanner.go +++ b/internal/pkg/localFileStructure/filesystemScanner.go @@ -82,7 +82,7 @@ func ScanLocalFileStructure(path string, extensions []string, ignoreDirs []strin fileMap[path] = &FilesystemNode{ Key: key, Path: path, - Name: info.Name(), + Name: filepath.Base(key), IsDir: info.IsDir(), ModTime: info.ModTime(), }