Fix erroneous caching of attachment path after relinking

This commit is contained in:
Dan Stillman 2008-10-15 06:27:52 +00:00
parent 5b3a3a1ad2
commit 1fad45da63

View file

@ -2279,16 +2279,14 @@ Zotero.Item.prototype.renameAttachmentFile = function(newName, overwrite) {
Zotero.Item.prototype.relinkAttachmentFile = function(file) { Zotero.Item.prototype.relinkAttachmentFile = function(file) {
var linkMode = this.getAttachmentLinkMode(); var linkMode = this.attachmentLinkMode;
if (linkMode == Zotero.Attachments.LINK_MODE_LINKED_URL) { if (linkMode == Zotero.Attachments.LINK_MODE_LINKED_URL) {
throw('Cannot relink linked URL in Zotero.Items.relinkAttachmentFile()'); throw('Cannot relink linked URL in Zotero.Items.relinkAttachmentFile()');
} }
var path = Zotero.Attachments.getPath(file, linkMode); var path = Zotero.Attachments.getPath(file, linkMode);
this.attachmentPath = path;
var sql = "UPDATE itemAttachments SET path=? WHERE itemID=?"; this.save();
Zotero.DB.query(sql, [path, this.id]);
} }