Skip to content

Commit

Permalink
Merge pull request #4101 from ethereum/fixdragancenstor
Browse files Browse the repository at this point in the history
fix dragging into ancestor
  • Loading branch information
bunsenstraat authored Sep 27, 2023
2 parents 1d5d832 + cc7beac commit 057f269
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion apps/remix-ide/src/app/files/fileManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -938,9 +938,16 @@ 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)
const provider = this.fileProviderOf(src)

if (await this.exists(dest + '/' + dirName) || src === dest) {
return false
}

if (provider.isSubDirectory(src, dest)) {
this.call('notification', 'toast', recursivePasteToastMsg())
return false
}
return true
} catch (e) {
console.log(e)
Expand Down Expand Up @@ -998,7 +1005,13 @@ class FileManager extends Plugin {
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)
const provider = this.fileProviderOf(src)

if (provider.isSubDirectory(src, dest)) {
this.call('notification', 'toast', recursivePasteToastMsg())
return false
}
await this.inDepthCopy(src, dest, dirName)
await this.remove(src)

} catch (e) {
Expand Down

0 comments on commit 057f269

Please sign in to comment.