filemanager: find a new unique name when file copy clashes
This commit is contained in:
@@ -2830,9 +2830,12 @@ angular.module('Application').service('Client', ['$http', '$interval', '$timeout
|
||||
};
|
||||
|
||||
Client.prototype.filesCopy = function (id, type, path, newPath, callback) {
|
||||
var that = this;
|
||||
|
||||
var objpath = (type === 'app' ? 'apps/' : 'volumes/') + id;
|
||||
|
||||
put('/api/v1/' + objpath + '/files/' + path, { action: 'copy', newFilePath: decodeURIComponent(newPath) }, {}, function (error, data, status) {
|
||||
if (error && error.statusCode === 409) return that.filesCopy(id, type, path, newPath + '-copy', callback);
|
||||
if (error) return callback(error);
|
||||
if (status !== 200) return callback(new ClientError(status, data));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user