commit 7637434a2a23ab1a608487303b5248aad3792d5f
parent 552008468ed1ddc4c75cfc8094c1e8bc813733ab
Author: Dan Stillman <dstillman@zotero.org>
Date: Thu, 14 Aug 2008 17:58:45 +0000
Fix error saving imported attachments on trunk (since r3178)
Diffstat:
2 files changed, 14 insertions(+), 1 deletion(-)
diff --git a/chrome/content/zotero/xpcom/attachments.js b/chrome/content/zotero/xpcom/attachments.js
@@ -300,6 +300,7 @@ Zotero.Attachments = new function(){
attachmentItem.save();
Zotero.Notifier.trigger('add', 'item', itemID);
+ Zotero.Notifier.trigger('modify', 'item', sourceItemID);
// We don't have any way of knowing that the file
// is flushed to disk, so we just wait a second
diff --git a/chrome/content/zotero/xpcom/data/item.js b/chrome/content/zotero/xpcom/data/item.js
@@ -2297,6 +2297,10 @@ Zotero.Item.prototype.__defineGetter__('attachmentLinkMode', function () {
return this._attachmentLinkMode;
}
+ if (!this.id) {
+ return '';
+ }
+
var sql = "SELECT linkMode FROM itemAttachments WHERE itemID=?";
var linkMode = Zotero.DB.valueQuery(sql, this.id);
this._attachmentLinkMode = linkMode;
@@ -2349,6 +2353,10 @@ Zotero.Item.prototype.__defineGetter__('attachmentMIMEType', function () {
return this._attachmentMIMEType;
}
+ if (!this.id) {
+ return '';
+ }
+
var sql = "SELECT mimeType FROM itemAttachments WHERE itemID=?";
var mimeType = Zotero.DB.valueQuery(sql, this.id);
if (!mimeType) {
@@ -2398,6 +2406,10 @@ Zotero.Item.prototype.__defineGetter__('attachmentCharset', function () {
return this._attachmentCharset;
}
+ if (!this.id) {
+ return '';
+ }
+
var sql = "SELECT charsetID FROM itemAttachments WHERE itemID=?";
var charset = Zotero.DB.valueQuery(sql, this.id);
if (!charset) {
@@ -2439,7 +2451,7 @@ Zotero.Item.prototype.__defineGetter__('attachmentPath', function () {
}
if (!this.id) {
- return undefined;
+ return '';
}
var sql = "SELECT path FROM itemAttachments WHERE itemID=?";