From 17daf9fe8dc792b1554a2a17e153fb90290617b3 Mon Sep 17 00:00:00 2001 From: Abe Jellinek Date: Tue, 15 Aug 2023 17:53:05 -0400 Subject: [PATCH] Fix EPUB attachments with wrong MIME type on view Fixes #3320 --- chrome/content/zotero/zoteroPane.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/chrome/content/zotero/zoteroPane.js b/chrome/content/zotero/zoteroPane.js index 5ff5eed13a..ed60021552 100644 --- a/chrome/content/zotero/zoteroPane.js +++ b/chrome/content/zotero/zoteroPane.js @@ -4708,11 +4708,13 @@ var ZoteroPane = new function() if(typeof itemIDs != "object") itemIDs = [itemIDs]; var launchFile = async (path, contentType, itemID) => { - // Fix blank PDF attachment MIME type - if (!contentType) { + // Fix blank PDF MIME type and incorrect EPUB MIME type + if (!contentType || contentType === 'application/epub') { let item = await Zotero.Items.getAsync(itemID); let path = await item.getFilePathAsync(); - let type = 'application/pdf'; + let type = contentType === 'application/epub' + ? 'application/epub+zip' + : 'application/pdf'; if (Zotero.MIME.sniffForMIMEType(await Zotero.File.getSample(path)) == type) { contentType = type; item.attachmentContentType = type;