summaryrefslogtreecommitdiffstats
path: root/modules
diff options
context:
space:
mode:
authorslene <vslene@gmail.com>2014-03-28 00:30:20 +0800
committerslene <vslene@gmail.com>2014-03-28 00:30:20 +0800
commit346db02d89ae0337956607eec43a0cd3f184fda8 (patch)
tree5caaf3f50191b211f44b5ff8253df5856afab50c /modules
parent16cb1e974ca2e34384cd7882886f46f860ea5640 (diff)
downloadgitea-346db02d89ae0337956607eec43a0cd3f184fda8.tar.gz
gitea-346db02d89ae0337956607eec43a0cd3f184fda8.zip
fix image display
Diffstat (limited to 'modules')
-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 c722f04b2e..a98ca8cf00 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, "img/") != -1 {
+ return contentType, true
+ }
+ return contentType, false
+}
+
func IsReadmeFile(name string) bool {
name = strings.ToLower(name)
if len(name) < 6 {