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.
This commit is contained in:
parent
b0d576b089
commit
76ef177e82
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user