filemanager: ask user for confirmation on rename conflict
This commit is contained in:
@@ -378,8 +378,24 @@ export default {
|
||||
|
||||
},
|
||||
async renameHandler(file, newName) {
|
||||
await this.directoryModel.rename(this.directoryModel.buildFilePath(this.cwd, file.name), sanitize(this.cwd + '/' + newName));
|
||||
await this.loadCwd();
|
||||
try {
|
||||
await this.directoryModel.rename(this.directoryModel.buildFilePath(this.cwd, file.name), sanitize(this.cwd + '/' + newName));
|
||||
await this.loadCwd();
|
||||
} catch (e) {
|
||||
if (e.status === 409) {
|
||||
this.$confirm.require({
|
||||
message: this.$t('filemanager.renameDialog.reallyOverwrite'),
|
||||
icon: '',
|
||||
acceptClass: 'p-button-danger',
|
||||
accept: async () => {
|
||||
await this.directoryModel.rename(this.directoryModel.buildFilePath(this.cwd, file.name), sanitize(this.cwd + '/' + newName), true /* overwrite */);
|
||||
await this.loadCwd();
|
||||
this.$confirm.close();
|
||||
}
|
||||
});
|
||||
}
|
||||
else console.error(`Failed to rename ${file} to ${newName}`, e);
|
||||
}
|
||||
},
|
||||
async changeOwnerHandler(files, newOwnerUid) {
|
||||
if (!files) return;
|
||||
|
||||
Reference in New Issue
Block a user