diff options
author | Lunny Xiao <xiaolunwen@gmail.com> | 2014-03-28 10:51:42 +0800 |
---|---|---|
committer | Lunny Xiao <xiaolunwen@gmail.com> | 2014-03-28 10:51:42 +0800 |
commit | 89258e868b070ff3046de912e1d9a3009f923b62 (patch) | |
tree | 96d582c68daf862d0328e0734ede3da88e308fb8 /modules/base/markdown.go | |
parent | 922a189f4061796b0d4afeeb45e508c36cc5e7fc (diff) | |
parent | 5344a0300383c4921e4a5810dff58c7686412f0c (diff) |
Merge branch 'master' of github.com:gogits/gogs
Diffstat (limited to 'modules/base/markdown.go')
-rw-r--r-- | modules/base/markdown.go | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/modules/base/markdown.go b/modules/base/markdown.go index c722f04b..962e1ae1 100644 --- a/modules/base/markdown.go +++ b/modules/base/markdown.go @@ -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, "image/") != -1 { + return contentType, true + } + return contentType, false +} + func IsReadmeFile(name string) bool { name = strings.ToLower(name) if len(name) < 6 { |