Bail on attachment save if HEAD request returns a status code other than 200 or 204

This commit is contained in:
Dan Stillman 2009-01-15 04:24:10 +00:00
parent d5989a3d1e
commit a1277ccaa9

View file

@ -192,6 +192,12 @@ Zotero.Attachments = new function(){
} }
Zotero.Utilities.HTTP.doHead(url, function(obj){ 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 mimeType = obj.channel.contentType;
var nsIURL = Components.classes["@mozilla.org/network/standard-url;1"] var nsIURL = Components.classes["@mozilla.org/network/standard-url;1"]