Skip to content

Commit

Permalink
Ⓜ️ Ignore assets with sha extension
Browse files Browse the repository at this point in the history
  • Loading branch information
jsnjack committed Oct 7, 2024
1 parent c15b12a commit 4b37b84
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
1 change: 1 addition & 0 deletions cmd/install.go
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,7 @@ func filterSuitableAssets(input []string, filters []string) []string {
filtered = exludeExtensions(filtered, ".sha256")
filtered = exludeExtensions(filtered, ".sha256sum")
filtered = exludeExtensions(filtered, ".md5")
filtered = exludeExtensions(filtered, ".sha")
return filtered
}

Expand Down
22 changes: 22 additions & 0 deletions cmd/install_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,28 @@ func TestInstall_filterSuitableAssets_filter_out_md5(t *testing.T) {
}
}

func TestInstall_filterSuitableAssets_filter_out_sha(t *testing.T) {
input := []string{
"micro-2.0.14-linux64-static.tar.gz",
"micro-2.0.14-linux64-static.tar.gz.sha",
}
expected := []string{
"micro-2.0.14-linux64-static.tar.gz",
}
output := filterSuitableAssets(input, []string{})

if len(output) != len(expected) {
t.Errorf("Unexpected amount of items in <output>: got %d want %d", len(output), len(expected))
return
}

for _, item := range expected {
if !stringInSlice(item, output) {
t.Errorf("Expected %s to be in <output>, got %s", item, output)
}
}
}

func stringInSlice(a string, list []string) bool {
for _, b := range list {
if b == a {
Expand Down

0 comments on commit 4b37b84

Please sign in to comment.