Skip to content

Commit

Permalink
Use Z instead of zlib
Browse files Browse the repository at this point in the history
Signed-off-by: egibs <[email protected]>
  • Loading branch information
egibs committed Dec 17, 2024
1 parent 863ae98 commit f9f4cfa
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion pkg/action/archive.go
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ func extractGzip(ctx context.Context, d string, f string) error {
if _, err := io.Copy(ef, io.LimitReader(gr, maxBytes)); err != nil {
return fmt.Errorf("failed to copy file: %w", err)
}
case "zlib":
case "Z":
zr, err := zlib.NewReader(gf)
if err != nil {
return fmt.Errorf("failed to create zlib reader: %w", err)
Expand Down
6 changes: 3 additions & 3 deletions pkg/programkind/programkind.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import (
// file extension to MIME type, if it's a good scanning target.
var supportedKind = map[string]string{
"7z": "",
"Z": "application/zlib",
"asm": "",
"bash": "application/x-bsh",
"bat": "application/bat",
Expand Down Expand Up @@ -58,9 +59,9 @@ var supportedKind = map[string]string{
"pyc": "application/x-python-code",
"rb": "text/x-ruby",
"rs": "text/x-rust",
"script": "text/x-generic-script",
"scpt": "application/x-applescript",
"scptd": "application/x-applescript",
"script": "text/x-generic-script",
"service": "text/x-systemd",
"sh": "application/x-sh",
"so": "application/x-sharedlib",
Expand All @@ -69,7 +70,6 @@ var supportedKind = map[string]string{
"yaml": "",
"yara": "",
"yml": "",
"zlib": "application/zlib",
"zsh": "application/x-zsh",
}

Expand Down Expand Up @@ -183,7 +183,7 @@ func File(path string) (*FileType, error) {
case hdr[0] == '\x1f' && hdr[1] == '\x8b':
return Path(".gzip"), nil
case hdr[0] == '\x78' && hdr[1] == '\x5E':
return Path(".zlib"), nil
return Path(".Z"), nil
}
return nil, nil
}
Expand Down

0 comments on commit f9f4cfa

Please sign in to comment.