Skip to content

Commit

Permalink
fix github updater (#792)
Browse files Browse the repository at this point in the history
  • Loading branch information
davidnewhall authored Jul 29, 2024
2 parents 10af186 + 9978af0 commit 68fc4d4
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions pkg/update/update.go
Original file line number Diff line number Diff line change
Expand Up @@ -162,17 +162,17 @@ func (u *Command) writeFile(ctx context.Context, folderPath string) (string, err

func (u *Command) decompressFile(tempFile *os.File, resp io.Reader, size int64) error {
switch {
case strings.Contains(u.URL, ".zip?stamp"):
case strings.Contains(u.URL, ".zip?stamp"), strings.HasSuffix(u.URL, ".zip"):
if body, err := io.ReadAll(resp); err != nil {
return fmt.Errorf("reading file from URL: %w", err)
} else if err := u.writeZipFile(tempFile, body, size); err != nil {
return err
}
case strings.Contains(u.URL, ".gz?stamp"):
case strings.Contains(u.URL, ".gz?stamp"), strings.HasSuffix(u.URL, ".gz"):
if err := u.writeGZipFile(tempFile, resp); err != nil {
return err
}
case strings.Contains(u.URL, ".bz2?stamp"):
case strings.Contains(u.URL, ".bz2?stamp"), strings.HasSuffix(u.URL, ".bz2"):
if _, err := io.Copy(tempFile, bzip2.NewReader(resp)); err != nil {
return fmt.Errorf("bzunzipping temporary file: %w", err)
}
Expand Down

0 comments on commit 68fc4d4

Please sign in to comment.