mirror of
https://github.com/aquasecurity/trivy.git
synced 2025-12-22 23:26:39 -08:00
feat(image): support tar.gz image (fanal#40)
This commit is contained in:
@@ -2,6 +2,7 @@ package utils
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"io"
|
||||
"os"
|
||||
"os/exec"
|
||||
"path/filepath"
|
||||
@@ -37,3 +38,13 @@ func IsCommandAvailable(name string) bool {
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
func IsGzip(f *os.File) bool {
|
||||
buf := make([]byte, 3)
|
||||
n, _ := f.Read(buf)
|
||||
defer f.Seek(0, io.SeekStart)
|
||||
if n < 3 {
|
||||
return false
|
||||
}
|
||||
return buf[0] == 0x1F && buf[1] == 0x8B && buf[2] == 0x8
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user