www

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | Submodules | README | LICENSE

commit 430e43a6b6aa26d1ba1c30b07d2bad45466d1537
parent c6da52f24b6d6253944d2fe6df261514ec39293a
Author: Simon Kornblith <simon@simonster.com>
Date:   Sun, 22 Jul 2012 01:48:18 -0400

Fix handling of MIME type mismatches

Diffstat:
Mchrome/content/zotero/xpcom/connector/translate_item.js | 34++++++++++++++++++----------------
1 file changed, 18 insertions(+), 16 deletions(-)

diff --git a/chrome/content/zotero/xpcom/connector/translate_item.js b/chrome/content/zotero/xpcom/connector/translate_item.js @@ -282,7 +282,7 @@ Zotero.Translate.ItemSaver.prototype = { } } - if(err) throw err; + if(err) Zotero.logError(err); }); }; @@ -360,21 +360,23 @@ Zotero.Translate.ItemSaver.prototype = { } } - attachment.mimeType = contentType; - attachment.linkMode = "imported_url"; - switch(contentType.toLowerCase()) { - case "application/pdf": - attachment.filename = baseName+".pdf"; - break; - case "text/html": - case "application/xhtml+xml": - attachment.filename = baseName+".html"; - break; - default: - attachment.filename = baseName; + if(!err) { + attachment.mimeType = contentType; + attachment.linkMode = "imported_url"; + switch(contentType.toLowerCase()) { + case "application/pdf": + attachment.filename = baseName+".pdf"; + break; + case "text/html": + case "application/xhtml+xml": + attachment.filename = baseName+".html"; + break; + default: + attachment.filename = baseName; + } + if(charset) attachment.charset = charset; + headersValidated = true; } - if(charset) attachment.charset = charset; - headersValidated = true; } // If we didn't validate the headers, cancel the request @@ -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); } };