diff options
author | zeripath <art27@cantab.net> | 2020-03-27 07:49:39 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-03-27 09:49:39 +0200 |
commit | 453f6e6e5a0c9ac43c5d30d14f036d93742894d4 (patch) | |
tree | 6afc845568c33ccfa8b7e969668c28b3340f333b /models/ssh_key.go | |
parent | cf4f2cfa3ee0e71632df971e154c7b926c39ba80 (diff) | |
download | gitea-453f6e6e5a0c9ac43c5d30d14f036d93742894d4.tar.gz gitea-453f6e6e5a0c9ac43c5d30d14f036d93742894d4.zip |
In authorized_keys use double-quote for windows compatibility (#10841)
Co-authored-by: Lauris BH <lauris@nix.lv>
Diffstat (limited to 'models/ssh_key.go')
-rw-r--r-- | models/ssh_key.go | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/models/ssh_key.go b/models/ssh_key.go index 5d9f5afef8..1e1cdad404 100644 --- a/models/ssh_key.go +++ b/models/ssh_key.go @@ -36,7 +36,8 @@ import ( const ( tplCommentPrefix = `# gitea public key` - tplPublicKey = tplCommentPrefix + "\n" + `command="%s --config='%s' serv key-%d",no-port-forwarding,no-X11-forwarding,no-agent-forwarding,no-pty %s` + "\n" + tplCommand = "%s --config=%q serv key-%d" + tplPublicKey = tplCommentPrefix + "\n" + `command=%q,no-port-forwarding,no-X11-forwarding,no-agent-forwarding,no-pty %s` + "\n" ) var sshOpLocker sync.Mutex @@ -81,7 +82,7 @@ func (key *PublicKey) OmitEmail() string { // AuthorizedString returns formatted public key string for authorized_keys file. func (key *PublicKey) AuthorizedString() string { - return fmt.Sprintf(tplPublicKey, setting.AppPath, setting.CustomConf, key.ID, key.Content) + return fmt.Sprintf(tplPublicKey, fmt.Sprintf(tplCommand, setting.AppPath, setting.CustomConf, key.ID), key.Content) } func extractTypeFromBase64Key(key string) (string, error) { |