fix: open all the pdf files correctly (#1742)

This commit is contained in:
niubility000 authored and GitHub committed 2022-01-10 17:01:21 +01:00
1 parent 665e45889c
commit 949f0f277f
2 files changed
+4

No files matched your search

+3
View File
@@ -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"