Fix handling of MIME type mismatches
This commit is contained in:
parent
c6da52f24b
commit
430e43a6b6
1 changed files with 18 additions and 16 deletions
|
@ -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);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue