From 76ef177e82b4fc17c572102c2a2fdde67602ec2c Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Fri, 6 Jun 2008 09:20:12 +0000 Subject: [PATCH] Addresses #901, downloadAssociatedFiles pref has no effect if automaticSnapshots is false The URL check wasn't sufficient. On JSTOR, for example, with the snapshot pref disabled and the download pref enabled, it would still return both a snapshot and a PDF, since the snapshot's URL is different from the URL in the URL field. (JSTOR records actually shouldn't have a URL field value at all, but that's #827.) Now saving only if snapshot pref is on or attachment isn't HTML. --- chrome/content/zotero/xpcom/translate.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/chrome/content/zotero/xpcom/translate.js b/chrome/content/zotero/xpcom/translate.js index 1b7377d86..aaacc6e39 100644 --- a/chrome/content/zotero/xpcom/translate.js +++ b/chrome/content/zotero/xpcom/translate.js @@ -1321,6 +1321,7 @@ Zotero.Translate.prototype._itemDone = function(item, attachedTo) { } else if(attachment.document || (attachment.mimeType && attachment.mimeType == "text/html") || downloadAssociatedFiles) { + // if snapshot is not explicitly set to false, retrieve snapshot if(attachment.document) { try { @@ -1328,7 +1329,10 @@ Zotero.Translate.prototype._itemDone = function(item, attachedTo) { } catch(e) { Zotero.debug("Translate: error attaching document"); } - } else if(attachment.url != item.url || automaticSnapshots) { + // Save attachment if snapshot pref enabled or not HTML + // (in which case downloadAssociatedFiles applies) + } else if(automaticSnapshots || !attachment.mimeType + || attachment.mimeType != "text/html") { var mimeType = null; var title = null; @@ -1356,7 +1360,7 @@ Zotero.Translate.prototype._itemDone = function(item, attachedTo) { Zotero.Attachments.importFromURL(attachment.url, myID, title, fileBaseName); } catch(e) { Zotero.debug("Zotero.Translate: error adding attachment "+attachment.url); - } + } } } }