diff options
Diffstat (limited to 'modules')
-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 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 { |