Skip to content

Commit

Permalink
comments
Browse files Browse the repository at this point in the history
  • Loading branch information
laurentsimon committed May 3, 2022
1 parent ef246fc commit 4bb8c93
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions checks/raw/binary_artifact.go
Expand Up @@ -92,14 +92,18 @@ var checkBinaryFileContent fileparser.DoWhileTrueOnFileContent = func(path strin
return false, sce.WithMessage(sce.ErrScorecardInternal, fmt.Sprintf("filetype.Get:%v", err))
}

// Sanity check the file contains non-readable characters.
if isText(content) {
exists1 := binaryFileTypes[t.Extension]
if exists1 {
*pfiles = append(*pfiles, checker.File{
Path: path,
Type: checker.FileTypeBinary,
Offset: checker.OffsetDefault,
})
return true, nil
}

exists1 := binaryFileTypes[t.Extension]
exists2 := binaryFileTypes[strings.ReplaceAll(filepath.Ext(path), ".", "")]
if exists1 || exists2 {
if !isText(content) && exists2 {
*pfiles = append(*pfiles, checker.File{
Path: path,
Type: checker.FileTypeBinary,
Expand Down

0 comments on commit 4bb8c93

Please sign in to comment.