Skip to content

Commit 2b44913

Browse files
committedNov 15, 2019
Ensure provided directory has at least one yaml manifest file
Signed-off-by: Vu Dinh <[email protected]>
1 parent 662aca5 commit 2b44913

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed
 

‎pkg/lib/bundle/generate.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -104,13 +104,13 @@ func GetMediaType(directory string) (string, error) {
104104
for _, item := range items {
105105
if item.IsDir() {
106106
continue
107-
} else {
107+
} else if filepath.Ext(item.Name()) == ".yaml" {
108108
files = append(files, item.Name())
109109
}
110110
}
111111

112112
if len(files) == 0 {
113-
return "", fmt.Errorf("The directory %s contains no files", directory)
113+
return "", fmt.Errorf("The directory %s contains no yaml files", directory)
114114
}
115115

116116
// Validate the file names to determine media type

‎pkg/lib/bundle/generate_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ func TestGetMediaType(t *testing.T) {
3737
{
3838
testDir,
3939
"",
40-
fmt.Sprintf("The directory %s contains no files", testDir),
40+
fmt.Sprintf("The directory %s contains no yaml files", testDir),
4141
},
4242
}
4343

0 commit comments

Comments
 (0)