@@ -664,6 +664,19 @@ public async Task SetPathBoxDropDownFlyoutAsync(MenuFlyout flyout, PathBoxItem p
664664 }
665665 }
666666
667+ private static string NormalizePathInput ( string currentInput , bool isFtp )
668+ {
669+ if ( currentInput . Contains ( '/' ) && ! isFtp )
670+ currentInput = currentInput . Replace ( "/" , "\\ " , StringComparison . Ordinal ) ;
671+
672+ currentInput = currentInput . Replace ( "\\ \\ " , "\\ " , StringComparison . Ordinal ) ;
673+
674+ if ( currentInput . StartsWith ( '\\ ' ) && ! currentInput . StartsWith ( "\\ \\ " , StringComparison . Ordinal ) )
675+ currentInput = currentInput . Insert ( 0 , "\\ " ) ;
676+
677+ return currentInput ;
678+ }
679+
667680 public async Task CheckPathInputAsync ( string currentInput , string currentSelectedPath , IShellPage shellPage )
668681 {
669682 if ( currentInput . StartsWith ( '>' ) )
@@ -685,13 +698,7 @@ await DialogDisplayHelper.ShowDialogAsync("CommandNotExecutable".GetLocalizedRes
685698
686699 var isFtp = FtpHelpers . IsFtpPath ( currentInput ) ;
687700
688- if ( currentInput . Contains ( '/' ) && ! isFtp )
689- currentInput = currentInput . Replace ( "/" , "\\ " , StringComparison . Ordinal ) ;
690-
691- currentInput = currentInput . Replace ( "\\ \\ " , "\\ " , StringComparison . Ordinal ) ;
692-
693- if ( currentInput . StartsWith ( '\\ ' ) && ! currentInput . StartsWith ( "\\ \\ " , StringComparison . Ordinal ) )
694- currentInput = currentInput . Insert ( 0 , "\\ " ) ;
701+ currentInput = NormalizePathInput ( currentInput , isFtp ) ;
695702
696703 if ( currentSelectedPath == currentInput || string . IsNullOrWhiteSpace ( currentInput ) )
697704 return ;
@@ -810,8 +817,10 @@ public async Task SetAddressBarSuggestionsAsync(AutoSuggestBox sender, IShellPag
810817 else
811818 {
812819 IsCommandPaletteOpen = false ;
813- var isFtp = FtpHelpers . IsFtpPath ( sender . Text ) ;
814- var expandedPath = StorageFileExtensions . GetResolvedPath ( sender . Text , isFtp ) ;
820+ var currentInput = sender . Text ;
821+ var isFtp = FtpHelpers . IsFtpPath ( currentInput ) ;
822+ currentInput = NormalizePathInput ( currentInput , isFtp ) ;
823+ var expandedPath = StorageFileExtensions . GetResolvedPath ( currentInput , isFtp ) ;
815824 var folderPath = PathNormalization . GetParentDir ( expandedPath ) ?? expandedPath ;
816825 StorageFolderWithPath folder = await shellpage . FilesystemViewModel . GetFolderWithPathFromPathAsync ( folderPath ) ;
817826
0 commit comments