Fixed output text

This commit is contained in:
David Paz
2017-07-11 12:27:48 +02:00
parent b2fe3f69ce
commit bd402a063c
2 changed files with 22 additions and 16 deletions

View File

@ -53,20 +53,24 @@ func IsDocumentation(path string) bool {
return data.DocumentationMatchers.Match(path)
}
func IsImage(file string) bool {
index := strings.LastIndex(file, ".")
extension := file[index:]
func IsImage(path string) bool {
extension := filepath.Ext(path)
if extension == ".png" || extension == ".jpg" || extension == ".jpeg" || extension == ".gif" {
return true
}
return false
}
func GetMimeType(language string) string {
func GetMimeType(path string, language string) string {
if mime, ok := data.LanguagesMime[language]; ok {
return mime
}
if IsImage(path) {
return "image/" + filepath.Ext(path)[1:]
}
return "text/plain"
}