binary files are returned as OtherLanguage by GetLanguage

This commit is contained in:
Manuel Carmona
2017-07-04 11:22:01 +02:00
parent 9de4d35959
commit d8798c2dd9
2 changed files with 5 additions and 0 deletions

View File

@ -116,6 +116,10 @@ func GetLanguageBySpecificClassifier(content []byte, candidates []string, classi
// GetLanguages applies a sequence of strategies based on the given filename and content
// to find out the most probably languages to return.
func GetLanguages(filename string, content []byte) []string {
if IsBinary(content) {
return nil
}
var languages []string
candidates := []string{}
for _, strategy := range DefaultStrategies {