Returns text/plain when mime it's undefined

This commit is contained in:
David Paz
2017-07-10 12:59:39 +02:00
parent 125c802582
commit 25e12e9c03
2 changed files with 467 additions and 2 deletions

View File

@ -53,8 +53,12 @@ func IsDocumentation(path string) bool {
return data.DocumentationMatchers.Match(path)
}
func GetMimeType(file string) string {
return data.LanguagesMime[file]
func GetMimeType(language string) string {
if mime, ok := data.LanguagesMime[language]; ok {
return mime
}
return "text/plain"
}
const sniffLen = 8000