aboutsummaryrefslogtreecommitdiff
path: root/modules/base/markdown.go
diff options
context:
space:
mode:
authorLunny Xiao <xiaolunwen@gmail.com>2014-03-28 10:51:42 +0800
committerLunny Xiao <xiaolunwen@gmail.com>2014-03-28 10:51:42 +0800
commit89258e868b070ff3046de912e1d9a3009f923b62 (patch)
tree96d582c68daf862d0328e0734ede3da88e308fb8 /modules/base/markdown.go
parent922a189f4061796b0d4afeeb45e508c36cc5e7fc (diff)
parent5344a0300383c4921e4a5810dff58c7686412f0c (diff)
Merge branch 'master' of github.com:gogits/gogs
Diffstat (limited to 'modules/base/markdown.go')
-rw-r--r--modules/base/markdown.go8
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 {