Skip to content

Commit

Permalink
Skip binary files
Browse files Browse the repository at this point in the history
  • Loading branch information
ankane committed Mar 9, 2019
1 parent cba65a5 commit ddbd5b1
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions internal/files.go
Original file line number Diff line number Diff line change
Expand Up @@ -152,17 +152,20 @@ func findFileMatches(filename string) ([][]string, int) {
// rewind
file.Seek(0, 0)

if kind.MIME.Value == "application/zip" {
matchedValues := make([][]string, len(regexRules)+1)
count := 0

if kind.MIME.Type == "video" || kind.MIME.Value == "application/x-bzip2" {
// skip binary
return matchedValues, count
} else if kind.MIME.Value == "application/zip" {
// TODO make zip work with S3
reader, err := zip.OpenReader(filename)
if err != nil {
log.Fatal(err)
}
defer reader.Close()

matchedValues := make([][]string, len(regexRules)+1)
count := 0

for _, file := range reader.File {
if file.FileInfo().IsDir() {
continue
Expand Down

0 comments on commit ddbd5b1

Please sign in to comment.