www

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | Submodules | README | LICENSE

commit 9feadb8f42a8b0b0afbeac182b8c836e246b93ea
parent 6650646cbabe1bd59696a66ba73e2972d4298729
Author: Dan Stillman <dstillman@zotero.org>
Date:   Sat,  8 Aug 2009 18:18:49 +0000

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


Diffstat:
Mchrome/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 @@ -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; }