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

This commit is contained in:
niubility000
2022-01-11 00:01:21 +08:00
committed by GitHub
parent 665e45889c
commit 949f0f277f
2 changed files with 4 additions and 0 deletions

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"