@@ -681,21 +681,6 @@ class ContentDataProvider
681681 return ! ! newUri ;
682682 }
683683
684- private async checkIfItemExistsInTarget (
685- itemName : string ,
686- target : ContentItem ,
687- ) : Promise < boolean > {
688- try {
689- const children = await this . getChildren ( target ) ;
690- return children . some ( ( child ) => child . name === itemName ) ;
691- // eslint-disable-next-line @typescript-eslint/no-unused-vars
692- } catch ( error ) {
693- // If we can't retrieve children, assume the item doesn't exist
694- // to avoid blocking the move operation unnecessarily
695- return false ;
696- }
697- }
698-
699684 private async handleContentItemDrop (
700685 target : ContentItem ,
701686 item : ContentItem ,
@@ -711,19 +696,10 @@ class ContentDataProvider
711696 } else if ( target . type === FAVORITES_FOLDER_TYPE ) {
712697 success = await this . addToMyFavorites ( item ) ;
713698 } else {
714- // Check if an item with the same name already exists in the target
715- const itemExists = await this . checkIfItemExistsInTarget (
716- item . name ,
717- target ,
718- ) ;
719- if ( itemExists ) {
720- message = Messages . FileAlreadyExistsError ;
721- } else {
722- const targetUri = target . resourceId ?? target . uri ;
723- success = await this . moveItem ( item , targetUri ) ;
724- if ( success ) {
725- this . refresh ( ) ;
726- }
699+ const targetUri = target . resourceId ?? target . uri ;
700+ success = await this . moveItem ( item , targetUri ) ;
701+ if ( success ) {
702+ this . refresh ( ) ;
727703 }
728704 }
729705
@@ -742,20 +718,6 @@ class ContentDataProvider
742718 displayErrorMessages : boolean = true ,
743719 ) : Promise < boolean > {
744720 const folderName = basename ( path ) ;
745-
746- // Check if a folder with the same name already exists in the target
747- const itemExists = await this . checkIfItemExistsInTarget ( folderName , target ) ;
748- if ( itemExists ) {
749- displayErrorMessages &&
750- window . showErrorMessage (
751- l10n . t ( Messages . FileAlreadyExistsError , {
752- name : folderName ,
753- } ) ,
754- ) ;
755-
756- return false ;
757- }
758-
759721 const folder = await this . model . createFolder ( target , folderName ) ;
760722 let success = true ;
761723 if ( ! folder ) {
@@ -825,17 +787,6 @@ class ContentDataProvider
825787 return ;
826788 }
827789
828- // Check if a file with the same name already exists in the target
829- const itemExists = await this . checkIfItemExistsInTarget ( name , target ) ;
830- if ( itemExists ) {
831- window . showErrorMessage (
832- l10n . t ( Messages . FileAlreadyExistsError , {
833- name,
834- } ) ,
835- ) ;
836- return ;
837- }
838-
839790 const fileCreated = await this . createFile (
840791 target ,
841792 name ,
0 commit comments