Merge pull request #355 from gadfly3173/fix/edit-remote

fix: remove null-check of sshKey in EditRemote
This commit is contained in:
leo 2024-08-12 19:41:00 +08:00 committed by GitHub
commit 760fd5a3f0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -93,11 +93,8 @@ namespace SourceGit.ViewModels
public static ValidationResult ValidateSSHKey(string sshkey, ValidationContext ctx)
{
if (ctx.ObjectInstance is EditRemote edit && edit.UseSSH)
if (ctx.ObjectInstance is EditRemote { _useSSH: true } && !string.IsNullOrEmpty(sshkey))
{
if (string.IsNullOrEmpty(sshkey))
return new ValidationResult("SSH private key is required");
if (!File.Exists(sshkey))
return new ValidationResult("Given SSH private key can NOT be found!");
}