fix (untar) correct condition for gunzip file (#3679)

* debug if file is gzipped

* looking 3 byte value

* debug for gzip file

* reading decimal values instead of hexadecimal

* looking for byte values

* modifying return

* simplyfying conditions

* correcting err condition

* trying with hex

* using hex

Co-authored-by: anilkeshav27 <you@example.com>
Co-authored-by: Oliver Nocon <33484802+OliverNocon@users.noreply.github.com>
This commit is contained in:
Anil Keshav
2022-03-30 12:30:57 +02:00
committed by GitHub
co-authored by anilkeshav27 Oliver Nocon
parent 276844e6a2
commit e8fc08e43b
+1 -1
View File
@@ -239,7 +239,7 @@ func Untar(src string, dest string, stripComponentLevel int) error {
fmt.Errorf("unable to open src: %v", err)
}
if b, err := isFileGzipped(src); err != nil && b {
if b, err := isFileGzipped(src); err == nil && b {
zr, err := gzip.NewReader(file)
if err != nil {