fix image display

This commit is contained in:
slene 2014-03-28 00:30:20 +08:00
parent 16cb1e974c
commit 346db02d89
3 changed files with 26 additions and 9 deletions

View file

@ -51,6 +51,14 @@ func IsTextFile(data []byte) (string, bool) {
return contentType, false
}
func IsImageFile(data []byte) (string, bool) {
contentType := http.DetectContentType(data)
if strings.Index(contentType, "img/") != -1 {
return contentType, true
}
return contentType, false
}
func IsReadmeFile(name string) bool {
name = strings.ToLower(name)
if len(name) < 6 {