Fix missing PDF attachment MIME type on opening
This commit is contained in:
parent
15a0415eba
commit
62c6f561a6
1 changed files with 12 additions and 0 deletions
|
@ -4075,9 +4075,21 @@ var ZoteroPane = new function()
|
|||
}
|
||||
|
||||
var launchFile = async (path, contentType, itemID) => {
|
||||
// Fix blank PDF attachment MIME type
|
||||
if (!contentType) {
|
||||
let item = await Zotero.Items.getAsync(itemID);
|
||||
let path = await item.getFilePathAsync();
|
||||
let type = 'application/pdf';
|
||||
if (Zotero.MIME.sniffForMIMEType(await Zotero.File.getSample(path)) == type) {
|
||||
contentType = type;
|
||||
item.attachmentContentType = type;
|
||||
await item.saveTx();
|
||||
}
|
||||
}
|
||||
// Custom PDF handler
|
||||
if (contentType === 'application/pdf') {
|
||||
this.viewPDF(itemID, event.shiftKey);
|
||||
// TODO: Still leave an option to use an external PDF viewer
|
||||
return;
|
||||
let pdfHandler = Zotero.Prefs.get("fileHandler.pdf");
|
||||
if (pdfHandler) {
|
||||
|
|
Loading…
Reference in a new issue