From 949f0f277f6004904b3edfa716a8365ec93fa0fa Mon Sep 17 00:00:00 2001 From: niubility000 <76441520+niubility000@users.noreply.github.com> Date: Tue, 11 Jan 2022 00:01:21 +0800 Subject: [PATCH] fix: open all the pdf files correctly (#1742) --- files/file.go | 3 +++ frontend/src/components/files/ListingItem.vue | 1 + 2 files changed, 4 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" diff --git a/frontend/src/components/files/ListingItem.vue b/frontend/src/components/files/ListingItem.vue index bb374ec4..32753c84 100644 --- a/frontend/src/components/files/ListingItem.vue +++ b/frontend/src/components/files/ListingItem.vue @@ -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() {