aboutsummaryrefslogtreecommitdiff
path: root/modules/base/tool.go
diff options
context:
space:
mode:
Diffstat (limited to 'modules/base/tool.go')
-rw-r--r--modules/base/tool.go8
1 files changed, 8 insertions, 0 deletions
diff --git a/modules/base/tool.go b/modules/base/tool.go
index a426ca99..22a90daf 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
+}