From a1277ccaa9a227fac0c85285f5b4728e3092bff4 Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Thu, 15 Jan 2009 04:24:10 +0000 Subject: [PATCH] Bail on attachment save if HEAD request returns a status code other than 200 or 204 --- chrome/content/zotero/xpcom/attachments.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/chrome/content/zotero/xpcom/attachments.js b/chrome/content/zotero/xpcom/attachments.js index c2162b548..c8b636192 100644 --- a/chrome/content/zotero/xpcom/attachments.js +++ b/chrome/content/zotero/xpcom/attachments.js @@ -192,6 +192,12 @@ Zotero.Attachments = new function(){ } Zotero.Utilities.HTTP.doHead(url, function(obj){ + if (obj.status != 200 && obj.status != 204) { + Zotero.debug("Attachment HEAD request returned with status code " + + obj.status + " in Attachments.importFromURL()", 2); + return false; + } + var mimeType = obj.channel.contentType; var nsIURL = Components.classes["@mozilla.org/network/standard-url;1"]