diff --git a/chrome/content/zotero/xpcom/attachments.js b/chrome/content/zotero/xpcom/attachments.js index ef5c7c33b..a395aafde 100644 --- a/chrome/content/zotero/xpcom/attachments.js +++ b/chrome/content/zotero/xpcom/attachments.js @@ -89,6 +89,7 @@ Zotero.Attachments = new function(){ var mimeType = Zotero.MIME.getMIMETypeFromFile(newFile); + attachmentItem.attachmentMIMEType = mimeType; attachmentItem.attachmentPath = this.getPath(newFile, this.LINK_MODE_IMPORTED_FILE); attachmentItem.save(); @@ -1325,8 +1326,7 @@ Zotero.Attachments = new function(){ } var ext = Zotero.File.getExtension(file); - if (mimeType.substr(0, 5)!='text/' || - !Zotero.MIME.hasInternalHandler(mimeType, ext)){ + if (!Zotero.MIME.hasInternalHandler(mimeType, ext)) { return; } diff --git a/chrome/content/zotero/xpcom/mime.js b/chrome/content/zotero/xpcom/mime.js index 7a64e5f24..7b7b260ec 100644 --- a/chrome/content/zotero/xpcom/mime.js +++ b/chrome/content/zotero/xpcom/mime.js @@ -25,7 +25,6 @@ Zotero.MIME = new function(){ this.isTextType = isTextType; - this.isExternalTextExtension = isExternalTextExtension; this.getPrimaryExtension = getPrimaryExtension; this.sniffForMIMEType = sniffForMIMEType; this.sniffForBinary = sniffForBinary; @@ -92,14 +91,6 @@ Zotero.MIME = new function(){ } - /* - * Check if file extension should be forced to open externally - */ - function isExternalTextExtension(ext){ - return typeof _externalTextExtensions[ext] != 'undefined'; - } - - /* * Our own wrapper around the MIME service's getPrimaryExtension() that * works a little better @@ -326,20 +317,11 @@ Zotero.MIME = new function(){ * do what we need */ function hasNativeHandler(mimeType, ext) { - if (mimeType.match(/^text\//)) { - if (isExternalTextExtension(ext)){ - Zotero.debug(mimeType + " file has extension '" + ext + "' that should be handled externally"); - return false; - } - return true; - } - if (_nativeMIMETypes[mimeType]){ Zotero.debug('MIME type ' + mimeType + ' can be handled natively'); return true; } - - return null; + return false; } @@ -350,9 +332,8 @@ Zotero.MIME = new function(){ * Similar to hasNativeHandler() but also includes plugins */ function hasInternalHandler(mimeType, ext) { - var isNative = hasNativeHandler(mimeType, ext); - if (isNative !== null) { - return isNative; + if (hasNativeHandler(mimeType, ext)) { + return true; } if(mimeType === "application/pdf"