commit a3f5ead9876b5ae24b185d87a38e37edb78d32a1
parent f0bc0274f14867a2ffe638084ef424c81be7a60c
Author: Dan Stillman <dstillman@zotero.org>
Date: Sat, 22 Oct 2016 15:22:56 -0400
Fix file renaming and same-dir relinking (broken by 79baac3158)
Diffstat:
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/chrome/content/zotero/xpcom/data/item.js b/chrome/content/zotero/xpcom/data/item.js
@@ -2555,11 +2555,14 @@ Zotero.Item.prototype.relinkAttachmentFile = Zotero.Promise.coroutine(function*
yield OS.File.remove(newPath + ".bak");
}
}
- // Rename file to filtered name if necessary
- else if (fileName != newName) {
+ else {
newPath = OS.Path.join(OS.Path.dirname(path), newName);
- Zotero.debug("Renaming file '" + fileName + "' to '" + newName + "'");
- OS.File.move(path, newPath, { noOverwrite: true });
+
+ // Rename file to filtered name if necessary
+ if (fileName != newName) {
+ Zotero.debug("Renaming file '" + fileName + "' to '" + newName + "'");
+ yield OS.File.move(path, newPath, { noOverwrite: true });
+ }
}
this.attachmentPath = newPath;