From 9feadb8f42a8b0b0afbeac182b8c836e246b93ea Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Sat, 8 Aug 2009 18:18:49 +0000 Subject: [PATCH] Remove HEAD requests to determine MIME type from Zotero.Attachments.linkFromURL(), since they triggered during imports and the UI code doesn't use that method anymore anyway --- chrome/content/zotero/xpcom/attachments.js | 34 +++------------------- 1 file changed, 4 insertions(+), 30 deletions(-) diff --git a/chrome/content/zotero/xpcom/attachments.js b/chrome/content/zotero/xpcom/attachments.js index 59e36dfc3e..2d28272cab 100644 --- a/chrome/content/zotero/xpcom/attachments.js +++ b/chrome/content/zotero/xpcom/attachments.js @@ -387,7 +387,10 @@ Zotero.Attachments = new function(){ /* * Create a link attachment from a URL * - * Returns the itemID of the created attachment + * @param {String} url + * @param {Integer} sourceItemID Parent item + * @param {String} [mimeType] MIME type of page + * @param {String} [title] Title to use for attachment */ function linkFromURL(url, sourceItemID, mimeType, title){ Zotero.debug('Linking attachment from URL'); @@ -412,37 +415,8 @@ Zotero.Attachments = new function(){ mimeType = 'application/pdf'; } - // Disable the Notifier if we're going to do a HEAD for the MIME type - if (!mimeType) { - var disabled = Zotero.Notifier.disable(); - } - var itemID = _addToDB(null, url, title, this.LINK_MODE_LINKED_URL, mimeType, null, sourceItemID); - - if (disabled) { - Zotero.Notifier.enable(); - } - - if (!mimeType) { - // If we don't have the MIME type, do a HEAD request for it - Zotero.MIME.getMIMETypeFromURL(url, function (mimeType) { - if (mimeType) { - var disabled = Zotero.Notifier.disable(); - - var item = Zotero.Items.get(itemID); - item.attachmentMIMEType = mimeType; - item.save(); - - if (disabled) { - Zotero.Notifier.enable(); - } - } - - Zotero.Notifier.trigger('add', 'item', itemID); - }); - } - return itemID; }