Skip to content

Commit

Permalink
Do not unarchive if the binary does not have extension
Browse files Browse the repository at this point in the history
  • Loading branch information
babarot committed Mar 19, 2023
1 parent 8947559 commit d77db15
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion pkg/config/http.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ func (c HTTP) call(ctx context.Context) error {
return err
}

if err := unarchive(dest); err != nil {
if err := unarchiveV2(dest); err != nil {
return errors.Wrapf(err, "failed to unarchive: %s", dest)
}

Expand Down Expand Up @@ -125,6 +125,15 @@ func (c HTTP) Install(ctx context.Context, status chan<- Status) error {
return errs.ErrorOrNil()
}

func unarchiveV2(path string) error {
_, err := archiver.ByExtension(path)
if err != nil {
log.Printf("[DEBUG] unarchiveV2: no need to unarchive. finished with nil")
return nil
}
return archiver.Unarchive(path, filepath.Dir(path))
}

func unarchive(f string) error {
buf, err := ioutil.ReadFile(f)
if err != nil {
Expand Down

0 comments on commit d77db15

Please sign in to comment.