Skip to content

Commit 057f269

Browse files
authored
Merge pull request #4101 from ethereum/fixdragancenstor
fix dragging into ancestor
2 parents 1d5d832 + cc7beac commit 057f269

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

apps/remix-ide/src/app/files/fileManager.ts

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -938,9 +938,16 @@ class FileManager extends Plugin {
938938
await this._handleIsDir(src, `Cannot move ${src}. Path is not directory.`)
939939
await this._handleIsDir(dest, `Cannot move content into ${dest}. Path is not directory.`)
940940
const dirName = helper.extractNameFromKey(src)
941+
const provider = this.fileProviderOf(src)
942+
941943
if (await this.exists(dest + '/' + dirName) || src === dest) {
942944
return false
943945
}
946+
947+
if (provider.isSubDirectory(src, dest)) {
948+
this.call('notification', 'toast', recursivePasteToastMsg())
949+
return false
950+
}
944951
return true
945952
} catch (e) {
946953
console.log(e)
@@ -998,7 +1005,13 @@ class FileManager extends Plugin {
9981005
if (await this.exists(dest + '/' + dirName) || src === dest) {
9991006
throw createError({ code: 'EEXIST', message: `Cannot move ${src}. Folder already exists at destination ${dest}` })
10001007
}
1001-
await this.copyDir(src, dest, dirName)
1008+
const provider = this.fileProviderOf(src)
1009+
1010+
if (provider.isSubDirectory(src, dest)) {
1011+
this.call('notification', 'toast', recursivePasteToastMsg())
1012+
return false
1013+
}
1014+
await this.inDepthCopy(src, dest, dirName)
10021015
await this.remove(src)
10031016

10041017
} catch (e) {

0 commit comments

Comments
 (0)