From d3383adb71d7f05642610490b747f92958c7d357 Mon Sep 17 00:00:00 2001 From: Vincent Petry Date: Thu, 19 Nov 2015 11:42:17 +0100 Subject: [PATCH] Fix issue when renaming creates a separate entry --- apps/files/js/filelist.js | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/apps/files/js/filelist.js b/apps/files/js/filelist.js index 83c7e147d4..672c39a8bb 100644 --- a/apps/files/js/filelist.js +++ b/apps/files/js/filelist.js @@ -1806,10 +1806,8 @@ } function updateInList(fileInfo) { - tr.remove(); - tr = self.add(fileInfo, {updateSummary: false, silent: true}); - self.$fileList.trigger($.Event('fileActionsReady', {fileList: self, $files: $(tr)})); - self._updateDetailsView(fileInfo.name); + self.updateRow(tr, fileInfo); + self._updateDetailsView(fileInfo.name, false); } // TODO: too many nested blocks, move parts into functions @@ -1838,11 +1836,10 @@ td.children('a.name').show(); var path = tr.attr('data-path') || self.getCurrentDirectory(); - self.filesClient.move(path + '/' + oldName, path + '/' + newName) + self.filesClient.move(OC.joinPaths(path, oldName), OC.joinPaths(path, newName)) .done(function() { - var fileInfo = self.files.splice(tr.index(), 1)[0]; - fileInfo.name = newName; - updateInList(fileInfo); + oldFileInfo.name = newName; + updateInList(oldFileInfo); }) .fail(function(status) { // TODO: 409 means current folder does not exist, redirect ?