commit ae1e82494d900c0adaa0cecdc6b5edf8045286d8
parent c72da6b56807a93edd51762677c5492bfa6f6887
Author: Simon Kornblith <simon@simonster.com>
Date: Wed, 16 Mar 2011 23:19:29 +0000
Fail to import files with bad URIs
Diffstat:
1 file changed, 14 insertions(+), 13 deletions(-)
diff --git a/chrome/content/zotero/xpcom/translation/item_local.js b/chrome/content/zotero/xpcom/translation/item_local.js
@@ -229,29 +229,30 @@ Zotero.Translate.ItemSaver.prototype = {
var msg = "Error parsing attachment path: " + attachment.path;
Zotero.logError(msg);
Zotero.debug("Translate: " + msg, 2);
+ return;
}
- if (uri) {
- try {
- var file = uri.QueryInterface(Components.interfaces.nsIFileURL).file;
- if (file.path == '/') {
- var msg = "Error parsing attachment path: " + attachment.path;
- Zotero.logError(msg);
- Zotero.debug("Translate: " + msg, 2);
- }
- }
- catch (e) {
- var msg = "Error getting file from attachment path: " + attachment.path;
+ try {
+ var file = uri.QueryInterface(Components.interfaces.nsIFileURL).file;
+ if (file.path == '/') {
+ var msg = "Error parsing attachment path: " + attachment.path;
Zotero.logError(msg);
Zotero.debug("Translate: " + msg, 2);
+ return;
}
}
+ catch (e) {
+ var msg = "Error getting file from attachment path: " + attachment.path;
+ Zotero.logError(msg);
+ Zotero.debug("Translate: " + msg, 2);
+ return;
+ }
- if (!file || !file.exists()) {
+ if (!file.exists()) {
// use attachment title if possible, or else file leaf name
var title = attachment.title;
if(!title) {
- title = file ? file.leafName : '';
+ title = file.leafName;
}
var myID = Zotero.Attachments.createMissingAttachment(