diff --git a/src/Files.App/ViewModels/ItemViewModel.cs b/src/Files.App/ViewModels/ItemViewModel.cs index fdbef0b587de..a1a2cfa54c7f 100644 --- a/src/Files.App/ViewModels/ItemViewModel.cs +++ b/src/Files.App/ViewModels/ItemViewModel.cs @@ -139,7 +139,11 @@ public async Task SetWorkingDirectoryAsync(string? value) _ = Task.Run(() => jumpListService.AddFolderAsync(value)); WorkingDirectory = value; - GitDirectory = GitHelpers.GetGitRepositoryPath(WorkingDirectory, Path.GetPathRoot(WorkingDirectory)); + + var pathRoot = FtpHelpers.IsFtpPath(WorkingDirectory) + ? WorkingDirectory.Substring(0, FtpHelpers.GetRootIndex(WorkingDirectory)) + : Path.GetPathRoot(WorkingDirectory); + GitDirectory = pathRoot is null ? null : GitHelpers.GetGitRepositoryPath(WorkingDirectory, pathRoot); OnPropertyChanged(nameof(WorkingDirectory)); }