Skip to content

Commit 4b37b84

Browse files
committed
Ⓜ️ Ignore assets with sha extension
1 parent c15b12a commit 4b37b84

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed

cmd/install.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,7 @@ func filterSuitableAssets(input []string, filters []string) []string {
193193
filtered = exludeExtensions(filtered, ".sha256")
194194
filtered = exludeExtensions(filtered, ".sha256sum")
195195
filtered = exludeExtensions(filtered, ".md5")
196+
filtered = exludeExtensions(filtered, ".sha")
196197
return filtered
197198
}
198199

cmd/install_test.go

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -285,6 +285,28 @@ func TestInstall_filterSuitableAssets_filter_out_md5(t *testing.T) {
285285
}
286286
}
287287

288+
func TestInstall_filterSuitableAssets_filter_out_sha(t *testing.T) {
289+
input := []string{
290+
"micro-2.0.14-linux64-static.tar.gz",
291+
"micro-2.0.14-linux64-static.tar.gz.sha",
292+
}
293+
expected := []string{
294+
"micro-2.0.14-linux64-static.tar.gz",
295+
}
296+
output := filterSuitableAssets(input, []string{})
297+
298+
if len(output) != len(expected) {
299+
t.Errorf("Unexpected amount of items in <output>: got %d want %d", len(output), len(expected))
300+
return
301+
}
302+
303+
for _, item := range expected {
304+
if !stringInSlice(item, output) {
305+
t.Errorf("Expected %s to be in <output>, got %s", item, output)
306+
}
307+
}
308+
}
309+
288310
func stringInSlice(a string, list []string) bool {
289311
for _, b := range list {
290312
if b == a {

0 commit comments

Comments
 (0)