From 3df8eb60e3227b4cff671e4714d262603b82943b Mon Sep 17 00:00:00 2001 From: Kim Carlbäcker Date: Wed, 27 Apr 2016 03:48:44 +0200 Subject: PDF-Previews in file-lists now working (#3000) --- modules/base/tool.go | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'modules') diff --git a/modules/base/tool.go b/modules/base/tool.go index a426ca99b0..22a90daff7 100644 --- a/modules/base/tool.go +++ b/modules/base/tool.go @@ -522,3 +522,11 @@ func IsImageFile(data []byte) (string, bool) { } return contentType, false } + +func IsPDFFile(data []byte) (string, bool) { + contentType := http.DetectContentType(data) + if strings.Index(contentType, "application/pdf") != -1 { + return contentType, true + } + return contentType, false +} -- cgit v1.2.3