From 43988d63276f3ec06160f7bc49e20caf4555e9d4 Mon Sep 17 00:00:00 2001 From: niubility000 <76441520+niubility000@users.noreply.github.com> Date: Mon, 27 Dec 2021 10:59:49 +0800 Subject: [PATCH] Add files via upload --- files/file.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/files/file.go b/files/file.go index f05dacd6..36852f39 100644 --- a/files/file.go +++ b/files/file.go @@ -219,6 +219,9 @@ func (i *FileInfo) detectType(modify, saveContent, readHeader bool) error { case strings.HasPrefix(mimetype, "image"): i.Type = "image" return nil + case strings.HasSuffix(mimetype, "pdf"): + i.Type = "pdf" + return nil case (strings.HasPrefix(mimetype, "text") || !isBinary(buffer)) && i.Size <= 10*1024*1024: // 10 MB i.Type = "text"