From 0850ca94b13191b9ea48df6022945d6be17b8d50 Mon Sep 17 00:00:00 2001 From: Simon Kornblith Date: Sun, 7 Apr 2013 01:58:33 -0400 Subject: [PATCH] Revert "Don't set unknown mimeTypes to "application/octet-stream"" This reverts commit f64d0879264f7b681c8d27063d35c0df36cdab47. --- chrome/content/zotero/xpcom/mime.js | 2 ++ chrome/content/zotero/xpcom/translation/translate_item.js | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/chrome/content/zotero/xpcom/mime.js b/chrome/content/zotero/xpcom/mime.js index ca1d50dcf8..a89f167d4e 100644 --- a/chrome/content/zotero/xpcom/mime.js +++ b/chrome/content/zotero/xpcom/mime.js @@ -330,6 +330,8 @@ Zotero.MIME = new function(){ var mimeType = xmlhttp.channel.contentType; } + if(!mimeType) mimeType = 'application/octet-stream'; //unknown item type according to RFC 2046 section 4.5.1 + var nsIURL = Components.classes["@mozilla.org/network/standard-url;1"] .createInstance(Components.interfaces.nsIURL); nsIURL.spec = url; diff --git a/chrome/content/zotero/xpcom/translation/translate_item.js b/chrome/content/zotero/xpcom/translation/translate_item.js index aca7e64385..bd1d277059 100644 --- a/chrome/content/zotero/xpcom/translation/translate_item.js +++ b/chrome/content/zotero/xpcom/translation/translate_item.js @@ -411,12 +411,12 @@ Zotero.Translate.ItemSaver.prototype = { // Save attachment if snapshot pref enabled or not HTML // (in which case downloadAssociatedFiles applies) } else { - if(!attachment.mimeType && attachment.mimeType !== '') { + if(!attachment.mimeType && attachment.mimeType !== '') { //in case '' indicates unknwon mime type at some point Zotero.debug("Translate: No mimeType specified for a possible snapshot. Trying to determine mimeType.", 4); var me = this; try { Zotero.MIME.getMIMETypeFromURL(attachment.url, function (mimeType, hasNativeHandler) { - attachment.mimeType = mimeType || ''; + attachment.mimeType = mimeType; me._saveAttachmentDownload(attachment, parentID, attachmentCallback); }, this._cookieSandbox); } catch(e) {