Fix file renaming and same-dir relinking (broken by 79baac3158)

This commit is contained in:
Dan Stillman 2016-10-22 15:22:56 -04:00
parent f0bc0274f1
commit a3f5ead987

View file

@ -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;