From 894a5a1a8398559b226058736681f1370240a18e Mon Sep 17 00:00:00 2001 From: albertony <12441419+albertony@users.noreply.github.com> Date: Sun, 10 Oct 2021 14:35:57 +0200 Subject: [PATCH] serve sftp: fix generation of server keys on windows --- cmd/serve/sftp/server.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cmd/serve/sftp/server.go b/cmd/serve/sftp/server.go index 1a87fccbf..379f48eb5 100644 --- a/cmd/serve/sftp/server.go +++ b/cmd/serve/sftp/server.go @@ -239,14 +239,14 @@ func (s *server) serve() (err error) { if err != nil { return errors.Wrap(err, "failed to create cache path") } - if strings.HasSuffix(keyPath, "/id_rsa") { + if strings.HasSuffix(keyPath, string(os.PathSeparator)+"id_rsa") { const bits = 2048 fs.Logf(nil, "Generating %d bit key pair at %q", bits, keyPath) err = makeRSASSHKeyPair(bits, keyPath+".pub", keyPath) - } else if strings.HasSuffix(keyPath, "/id_ecdsa") { + } else if strings.HasSuffix(keyPath, string(os.PathSeparator)+"id_ecdsa") { fs.Logf(nil, "Generating ECDSA p256 key pair at %q", keyPath) err = makeECDSASSHKeyPair(keyPath+".pub", keyPath) - } else if strings.HasSuffix(keyPath, "/id_ed25519") { + } else if strings.HasSuffix(keyPath, string(os.PathSeparator)+"id_ed25519") { fs.Logf(nil, "Generating Ed25519 key pair at %q", keyPath) err = makeEd25519SSHKeyPair(keyPath+".pub", keyPath) } else {