diff --git a/src/js/filemanager.js b/src/js/filemanager.js index 6d944016a..2bf6eb57a 100644 --- a/src/js/filemanager.js +++ b/src/js/filemanager.js @@ -352,11 +352,11 @@ app.controller('FileManagerController', ['$scope', '$translate', '$timeout', 'Cl $scope.clipboardCut = false; }; - $scope.actionPaste = function () { + $scope.actionPaste = function (destinationEntry) { if ($scope.clipboardCut) { // move files async.eachLimit($scope.clipboard, 5, function (entry, callback) { - var newFilePath = sanitize($scope.cwd + '/' + entry.fileName); + var newFilePath = sanitize($scope.cwd + '/' + (destinationEntry.isDirectory ? destinationEntry.fileName : '') + '/' + entry.fileName); // TODO this will overwrite files in destination! Client.filesRename($scope.id, $scope.type, entry.fullFilePath, newFilePath, callback); @@ -880,7 +880,7 @@ app.controller('FileManagerController', ['$scope', '$translate', '$timeout', 'Cl text: tr['filemanager.list.menu.paste'], hasBottomDivider: true, enabled: function () { return $scope.clipboard.length; }, - click: function ($itemScope, $event, entry) { $scope.actionPaste(); } + click: function ($itemScope, $event, entry) { $scope.actionPaste(entry); } }, { text: tr['filemanager.list.menu.rename'], enabled: function () { return $scope.selected.length === 1; },