Skip to content

Commit 8611491

Browse files
authored
Fix: Fixed formatting bug when entering commands into the Address Bar (#15448)
1 parent 876d1c4 commit 8611491

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed

src/Files.App/ViewModels/UserControls/AddressToolbarViewModel.cs

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -720,30 +720,30 @@ await DialogDisplayHelper.ShowDialogAsync("CommandNotExecutable".GetLocalizedRes
720720

721721
var isFtp = FtpHelpers.IsFtpPath(currentInput);
722722

723-
currentInput = NormalizePathInput(currentInput, isFtp);
723+
var normalizedInput = NormalizePathInput(currentInput, isFtp);
724724

725-
if (currentSelectedPath == currentInput || string.IsNullOrWhiteSpace(currentInput))
725+
if (currentSelectedPath == normalizedInput || string.IsNullOrWhiteSpace(normalizedInput))
726726
return;
727727

728-
if (currentInput != shellPage.FilesystemViewModel.WorkingDirectory || shellPage.CurrentPageType == typeof(HomePage))
728+
if (normalizedInput != shellPage.FilesystemViewModel.WorkingDirectory || shellPage.CurrentPageType == typeof(HomePage))
729729
{
730-
if (currentInput.Equals("Home", StringComparison.OrdinalIgnoreCase) || currentInput.Equals("Home".GetLocalizedResource(), StringComparison.OrdinalIgnoreCase))
730+
if (normalizedInput.Equals("Home", StringComparison.OrdinalIgnoreCase) || normalizedInput.Equals("Home".GetLocalizedResource(), StringComparison.OrdinalIgnoreCase))
731731
{
732732
SavePathToHistory("Home");
733733
shellPage.NavigateHome();
734734
}
735735
else
736736
{
737-
currentInput = StorageFileExtensions.GetResolvedPath(currentInput, isFtp);
738-
if (currentSelectedPath == currentInput)
737+
normalizedInput = StorageFileExtensions.GetResolvedPath(normalizedInput, isFtp);
738+
if (currentSelectedPath == normalizedInput)
739739
return;
740740

741-
var item = await FilesystemTasks.Wrap(() => DriveHelpers.GetRootFromPathAsync(currentInput));
741+
var item = await FilesystemTasks.Wrap(() => DriveHelpers.GetRootFromPathAsync(normalizedInput));
742742

743-
var resFolder = await FilesystemTasks.Wrap(() => StorageFileExtensions.DangerousGetFolderWithPathFromPathAsync(currentInput, item));
744-
if (resFolder || FolderHelpers.CheckFolderAccessWithWin32(currentInput))
743+
var resFolder = await FilesystemTasks.Wrap(() => StorageFileExtensions.DangerousGetFolderWithPathFromPathAsync(normalizedInput, item));
744+
if (resFolder || FolderHelpers.CheckFolderAccessWithWin32(normalizedInput))
745745
{
746-
var matchingDrive = drivesViewModel.Drives.Cast<DriveItem>().FirstOrDefault(x => PathNormalization.NormalizePath(currentInput).StartsWith(PathNormalization.NormalizePath(x.Path), StringComparison.Ordinal));
746+
var matchingDrive = drivesViewModel.Drives.Cast<DriveItem>().FirstOrDefault(x => PathNormalization.NormalizePath(normalizedInput).StartsWith(PathNormalization.NormalizePath(x.Path), StringComparison.Ordinal));
747747
if (matchingDrive is not null && matchingDrive.Type == Data.Items.DriveType.CDRom && matchingDrive.MaxSpace == ByteSizeLib.ByteSize.FromBytes(0))
748748
{
749749
bool ejectButton = await DialogDisplayHelper.ShowDialogAsync("InsertDiscDialog/Title".GetLocalizedResource(), string.Format("InsertDiscDialog/Text".GetLocalizedResource(), matchingDrive.Path), "InsertDiscDialog/OpenDriveButton".GetLocalizedResource(), "Close".GetLocalizedResource());
@@ -754,18 +754,18 @@ await DialogDisplayHelper.ShowDialogAsync("CommandNotExecutable".GetLocalizedRes
754754
}
755755
return;
756756
}
757-
var pathToNavigate = resFolder.Result?.Path ?? currentInput;
757+
var pathToNavigate = resFolder.Result?.Path ?? normalizedInput;
758758
SavePathToHistory(pathToNavigate);
759759
shellPage.NavigateToPath(pathToNavigate);
760760
}
761761
else if (isFtp)
762762
{
763-
SavePathToHistory(currentInput);
764-
shellPage.NavigateToPath(currentInput);
763+
SavePathToHistory(normalizedInput);
764+
shellPage.NavigateToPath(normalizedInput);
765765
}
766766
else // Not a folder or inaccessible
767767
{
768-
var resFile = await FilesystemTasks.Wrap(() => StorageFileExtensions.DangerousGetFileWithPathFromPathAsync(currentInput, item));
768+
var resFile = await FilesystemTasks.Wrap(() => StorageFileExtensions.DangerousGetFileWithPathFromPathAsync(normalizedInput, item));
769769
if (resFile)
770770
{
771771
var pathToInvoke = resFile.Result.Path;

0 commit comments

Comments
 (0)