common: Add filename parameter to GetLanguageByContent function

Internal code needs the filename to select a matcher, so not passing
any filename means no language will ever be found otherwise.
This commit is contained in:
Alfredo Beaumont 2017-08-08 11:58:02 +02:00
parent bac0ef279c
commit 0990c2868d

View File

@ -85,8 +85,8 @@ func GetLanguageByExtension(filename string) (language string, safe bool) {
// GetLanguageByContent returns detected language. If there are more than one possibles languages
// it returns the first language by alphabetically order and safe to false.
func GetLanguageByContent(content []byte) (language string, safe bool) {
return getLanguageByStrategy(GetLanguagesByContent, "", content, nil)
func GetLanguageByContent(filename string, content []byte) (language string, safe bool) {
return getLanguageByStrategy(GetLanguagesByContent, filename, content, nil)
}
// GetLanguageByClassifier returns the most probably language detected for the given content. It uses