Bail on attachment save if HEAD request returns a status code other than 200 or 204
This commit is contained in:
parent
d5989a3d1e
commit
a1277ccaa9
1 changed files with 6 additions and 0 deletions
|
@ -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"]
|
||||||
|
|
Loading…
Reference in a new issue