Skip to content

Commit

Permalink
Fix: Fixed a crash with ftp connections (#12228)
Browse files Browse the repository at this point in the history
  • Loading branch information
ferrariofilippo authored Apr 30, 2023
1 parent d8d10c2 commit 51b68b7
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/Files.App/ViewModels/ItemViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}

Expand Down

0 comments on commit 51b68b7

Please sign in to comment.