Browse Source

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

pull/1765/head
niubility000 4 months ago
committed by GitHub
parent
commit
949f0f277f
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 3
      files/file.go
  2. 1
      frontend/src/components/files/ListingItem.vue

3
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"

1
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() {

Loading…
Cancel
Save