From a24200b30c2ca21c60d1d8d3a90dbbe6b05052f0 Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Thu, 30 Oct 2008 19:57:51 +0000 Subject: [PATCH] Imported snapshot path wasn't being set properly --- chrome/content/zotero/xpcom/attachments.js | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/chrome/content/zotero/xpcom/attachments.js b/chrome/content/zotero/xpcom/attachments.js index dfd45768e1..d6eda4308b 100644 --- a/chrome/content/zotero/xpcom/attachments.js +++ b/chrome/content/zotero/xpcom/attachments.js @@ -141,19 +141,17 @@ Zotero.Attachments = new function(){ // translate.js, which sets the metadata fields itself var itemID = attachmentItem.save(); attachmentItem = Zotero.Items.get(itemID) - var attachmentKey = attachmentItem.key; + + var newFile = this.getStorageDirectory(itemID); + var newName = newFile.leafName; var storageDir = Zotero.getStorageDirectory(); - file.parent.copyTo(storageDir, attachmentKey); + file.parent.copyTo(storageDir, newName); // Point to copied file - var newFile = Components.classes["@mozilla.org/file/local;1"] - .createInstance(Components.interfaces.nsILocalFile); - newFile.initWithFile(storageDir); - newFile.append(attachmentKey); newFile.append(file.leafName); - attachmentItem.path = this.getPath(newFile, this.LINK_MODE_IMPORTED_URL); + attachmentItem.attachmentPath = this.getPath(newFile, this.LINK_MODE_IMPORTED_URL); attachmentItem.save(); Zotero.DB.commitTransaction();