Fail to import files with bad URIs

This commit is contained in:
Simon Kornblith 2011-03-16 23:19:29 +00:00
parent c72da6b568
commit ae1e82494d

View File

@ -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);
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(