Skip to content

Commit c5ae974

Browse files
committed
Use correct []byte reader interface.
1 parent b1597d5 commit c5ae974

File tree

2 files changed

+2
-6
lines changed

2 files changed

+2
-6
lines changed

internal/unarchiver/unarchiver.go

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,16 +27,13 @@ func NewTarGz() Unarchiver {
2727

2828
func NewZip() Unarchiver {
2929
return Unarchiver{
30-
archives.CompressedArchive{
31-
Extraction: archives.Zip{},
32-
},
30+
archives.Zip{},
3331
}
3432
}
3533

3634
// PrepareUnpacking prepares the destination directory and the archive for unpacking
3735
// Returns the opened file
3836
func (ua *Unarchiver) PrepareUnpacking(source, destination string) (archiveFile *os.File, err error) {
39-
4037
if !fileutils.DirExists(destination) {
4138
err := mkdir(destination)
4239
if err != nil {
@@ -50,7 +47,6 @@ func (ua *Unarchiver) PrepareUnpacking(source, destination string) (archiveFile
5047
}
5148

5249
return archiveFile, nil
53-
5450
}
5551

5652
// Unarchive unarchives an archive file and unpacks it in `destination`

internal/updater/fetcher.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ func (f *Fetcher) Fetch(update *UpdateInstaller, targetDir string) error {
8080
if runtime.GOOS == "windows" {
8181
ua = unarchiver.NewZip()
8282
}
83-
if err := ua.Unarchive(bytes.NewBuffer(b), targetDir); err != nil {
83+
if err := ua.Unarchive(bytes.NewReader(b), targetDir); err != nil {
8484
msg := "Unarchiving failed"
8585
f.analyticsEvent(update.AvailableUpdate.Version, msg)
8686
return errs.Wrap(err, msg)

0 commit comments

Comments
 (0)