Merge pull request #2863 from ethereum/fixdragdrop

Fixdragdrop
pull/2864/head
bunsenstraat 2 years ago committed by GitHub
commit 345f1dce59
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 7
      apps/remix-ide/src/app/files/fileManager.ts

@ -845,7 +845,7 @@ class FileManager extends Plugin {
const fileName = helper.extractNameFromKey(src)
if (await this.exists(dest + '/' + fileName)) {
throw createError({ code: 'ENOENT', message: `Cannot move ${src}. File already exists at destination ${dest}`})
throw createError({ code: 'EEXIST', message: `Cannot move ${src}. File already exists at destination ${dest}`})
}
await this.copyFile(src, dest, fileName)
await this.remove(src)
@ -872,9 +872,8 @@ class FileManager extends Plugin {
await this._handleIsDir(src, `Cannot move ${src}. Path is not directory.`)
await this._handleIsDir(dest, `Cannot move content into ${dest}. Path is not directory.`)
const dirName = helper.extractNameFromKey(src)
if (await this.exists(dest + '/' + dirName)) {
throw createError({ code: 'ENOENT', message: `Cannot move ${src}. Folder already exists at destination ${dest}`})
if (await this.exists(dest + '/' + dirName) || src === dest) {
throw createError({ code: 'EEXIST', message: `Cannot move ${src}. Folder already exists at destination ${dest}`})
}
await this.copyDir(src, dest, dirName)
await this.remove(src)

Loading…
Cancel
Save