Fix handling of MIME type mismatches

This commit is contained in:
Simon Kornblith 2012-07-22 01:48:18 -04:00
parent c6da52f24b
commit 430e43a6b6

View file

@ -282,7 +282,7 @@ Zotero.Translate.ItemSaver.prototype = {
}
}
if(err) throw err;
if(err) Zotero.logError(err);
});
};
@ -360,6 +360,7 @@ Zotero.Translate.ItemSaver.prototype = {
}
}
if(!err) {
attachment.mimeType = contentType;
attachment.linkMode = "imported_url";
switch(contentType.toLowerCase()) {
@ -376,6 +377,7 @@ Zotero.Translate.ItemSaver.prototype = {
if(charset) attachment.charset = charset;
headersValidated = true;
}
}
// If we didn't validate the headers, cancel the request
if(headersValidated === false && "abort" in xhr) xhr.abort();
@ -392,7 +394,7 @@ Zotero.Translate.ItemSaver.prototype = {
// If there was an error, throw it now
if(err) {
attachmentCallback(attachment, false, err);
throw err;
Zotero.logError(err);
}
};