From d77db1517d350d019b3acbbaa70476d4b74bfbf1 Mon Sep 17 00:00:00 2001 From: b4b4r07 Date: Mon, 20 Mar 2023 02:23:33 +0900 Subject: [PATCH] Do not unarchive if the binary does not have extension --- pkg/config/http.go | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/pkg/config/http.go b/pkg/config/http.go index 363a399..f6d9d35 100644 --- a/pkg/config/http.go +++ b/pkg/config/http.go @@ -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) } @@ -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 {