From 346db02d89ae0337956607eec43a0cd3f184fda8 Mon Sep 17 00:00:00 2001 From: slene Date: Fri, 28 Mar 2014 00:30:20 +0800 Subject: fix image display --- modules/base/markdown.go | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'modules/base') diff --git a/modules/base/markdown.go b/modules/base/markdown.go index c722f04b..a98ca8cf 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 { -- cgit v1.2.3