diff --git a/chrome/content/zotero/xpcom/attachments.js b/chrome/content/zotero/xpcom/attachments.js index 27b881262..0f499703b 100644 --- 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 index b8ee132dd..32ed36b48 100644 --- 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=?";