From db89785a8a08a58732a5aed1275c6bbbe39cca0b Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Tue, 13 May 2008 18:46:15 +0000 Subject: [PATCH] Don't do doHead if MIME type already set in Zotero.Attachments.linkFromURL() --- chrome/content/zotero/xpcom/attachments.js | 24 ++++++++++++---------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/chrome/content/zotero/xpcom/attachments.js b/chrome/content/zotero/xpcom/attachments.js index 127eb895d..36169562c 100644 --- a/chrome/content/zotero/xpcom/attachments.js +++ b/chrome/content/zotero/xpcom/attachments.js @@ -382,17 +382,19 @@ Zotero.Attachments = new function(){ Zotero.Notifier.enable(); } - // If we don't have the MIME type, do a HEAD request for it - Zotero.Utilities.HTTP.doHead(url, function(obj){ - var mimeType = obj.channel.contentType; - - if (mimeType) { - var sql = "UPDATE itemAttachments SET mimeType=? WHERE itemID=?"; - Zotero.DB.query(sql, [mimeType, itemID]); - } - - Zotero.Notifier.trigger('add', 'item', itemID); - }); + if (!mimeType) { + // If we don't have the MIME type, do a HEAD request for it + Zotero.Utilities.HTTP.doHead(url, function(obj){ + var mimeType = obj.channel.contentType; + + if (mimeType) { + var sql = "UPDATE itemAttachments SET mimeType=? WHERE itemID=?"; + Zotero.DB.query(sql, [mimeType, itemID]); + } + + Zotero.Notifier.trigger('add', 'item', itemID); + }); + } return itemID; }