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
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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"

View File

@ -72,6 +72,7 @@ export default {
if (this.type === "image") return "insert_photo";
if (this.type === "audio") return "volume_up";
if (this.type === "video") return "movie";
if (this.type === "pdf") return "picture_as_pdf";
return "insert_drive_file";
},
isDraggable() {