Skip to content

Commit

Permalink
Handle tgz (#28)
Browse files Browse the repository at this point in the history
  • Loading branch information
hannah98 authored Apr 6, 2024
1 parent 2b6a2b8 commit ab96998
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
7 changes: 2 additions & 5 deletions lib/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,8 @@ import (
)

func isArchiveFile(filePath string) bool {
fileExtension := filepath.Ext(filePath)
if fileExtension == ".br" || fileExtension == ".bz2" || fileExtension == ".zip" || fileExtension == ".gz" || fileExtension == ".lz4" || fileExtension == ".sz" || fileExtension == ".xz" || fileExtension == ".zst" || fileExtension == ".tar" || fileExtension == ".rar" {
return true
}
return false
_, err := archiver.ByExtension(filePath)
return err == nil
}

func isExecutableFile(filePath string) (bool, error) {
Expand Down
9 changes: 8 additions & 1 deletion lib/util_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,19 @@ func Test_isArchiveFile(t *testing.T) {
want: false,
},
{
name: "test1",
name: "test2",
args: args{
filePath: "Archive.tar.gz",
},
want: true,
},
{
name: "test3",
args: args{
filePath: "Archive.tgz",
},
want: true,
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
Expand Down

0 comments on commit ab96998

Please sign in to comment.