@@ -892,29 +892,27 @@ private async Task ConfirmNewFolder()
892892 {
893893 if ( string . IsNullOrWhiteSpace ( NewFolderName ) ) return ;
894894
895- // Use CurrentFolder which has the correct Id from LoadFiles response
896- FileManagerDirectoryContent parentFolder ;
897- if ( CurrentFolder != null )
895+ // If CurrentFolder is missing or has no Id, refresh from the server first
896+ if ( CurrentFolder == null || string . IsNullOrEmpty ( CurrentFolder . Id ) )
898897 {
899- parentFolder = new FileManagerDirectoryContent
900- {
901- Id = CurrentFolder . Id ,
902- Name = CurrentFolder . Name ,
903- FilterPath = NormalizePath ( CurrentFolder . FilterPath ?? "" ) ,
904- FilterId = CurrentFolder . FilterId ,
905- IsFile = false
906- } ;
898+ await LoadFiles ( ) ;
907899 }
908- else
900+
901+ // After refresh, if we still don't have a valid CurrentFolder with Id, abort
902+ if ( CurrentFolder == null || string . IsNullOrEmpty ( CurrentFolder . Id ) )
909903 {
910- // Fallback for root - this shouldn't normally happen as LoadFiles sets CurrentFolder
911- parentFolder = new FileManagerDirectoryContent
912- {
913- FilterPath = NormalizePath ( CurrentPath ) ,
914- IsFile = false
915- } ;
904+ return ;
916905 }
917906
907+ var parentFolder = new FileManagerDirectoryContent
908+ {
909+ Id = CurrentFolder . Id ,
910+ Name = CurrentFolder . Name ,
911+ FilterPath = string . IsNullOrEmpty ( CurrentFolder . FilterPath ) ? "" : NormalizePath ( CurrentFolder . FilterPath ) ,
912+ FilterId = CurrentFolder . FilterId ?? "" ,
913+ IsFile = false
914+ } ;
915+
918916 var args = new MfmFolderCreateEventArgs
919917 {
920918 FolderName = NewFolderName ,
0 commit comments