diff --git a/chrome/content/zotero/xpcom/attachments.js b/chrome/content/zotero/xpcom/attachments.js index 7582b70f1..4271728ac 100644 --- a/chrome/content/zotero/xpcom/attachments.js +++ b/chrome/content/zotero/xpcom/attachments.js @@ -258,6 +258,13 @@ Zotero.Attachments = new function(){ var browser = Zotero.HTTP.processDocuments( url, function() { + let channel = browser.docShell.currentDocumentChannel; + if (channel && (channel instanceof Components.interfaces.nsIHttpChannel)) { + if (channel.responseStatus < 200 || channel.responseStatus >= 400) { + deferred.reject(new Error("Invalid response "+channel.responseStatus+" "+channel.responseStatusText+" for '"+url+"'")); + return; + } + } return Zotero.Attachments.importFromDocument({ libraryID: libraryID, document: browser.contentDocument,