Skip to content

Commit

Permalink
🎨 Extract isXML function
Browse files Browse the repository at this point in the history
  • Loading branch information
jasonrudolph committed Jul 16, 2021
1 parent 879bfa2 commit 62b65b3
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion internal/cmd/submit/submit.go
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ func toTar(dir string) (dest string, err error) {
return err
}

if !bytes.EqualFold([]byte(filepath.Ext(info.Name())), []byte(".xml")) {
if !isXML(srcpath) {
return nil
}

Expand Down Expand Up @@ -367,3 +367,9 @@ func putS3Object(client *http.Client, id string, secret string, bucket string, o

return nil
}

// isXML returns true if the given filename has an XML extension
// (case-insensitive); false, otherwise.
func isXML(filename string) bool {
return bytes.EqualFold([]byte(filepath.Ext(filename)), []byte(".xml"))
}

0 comments on commit 62b65b3

Please sign in to comment.