diff options
author | Kim Carlbäcker <kim.carlbacker@gmail.com> | 2016-04-27 03:48:44 +0200 |
---|---|---|
committer | Unknwon <u@gogs.io> | 2016-04-26 21:48:44 -0400 |
commit | 3df8eb60e3227b4cff671e4714d262603b82943b (patch) | |
tree | 2e4111a94375faa1ae0acf6758b9dacec26cf9b9 /modules/base/tool.go | |
parent | 0325bec283db28ee6a464f2d1884df0c48977373 (diff) | |
download | gitea-3df8eb60e3227b4cff671e4714d262603b82943b.tar.gz gitea-3df8eb60e3227b4cff671e4714d262603b82943b.zip |
PDF-Previews in file-lists now working (#3000)
Diffstat (limited to 'modules/base/tool.go')
-rw-r--r-- | modules/base/tool.go | 8 |
1 files changed, 8 insertions, 0 deletions
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 +} |