summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDouwe Maan <douwe@gitlab.com>2015-10-09 11:38:59 +0000
committerDouwe Maan <douwe@gitlab.com>2015-10-09 11:38:59 +0000
commitdf3ae4ef134e32ea2f5421c163a65784fd41a6db (patch)
tree7375f761afc8a487a193affd387fa4903f2387e5 /lib
parent192dd58d0358ba4c0993170589c9ed250e1dc547 (diff)
parent69b41ba04331e95739b25c77b3f5f198c0e64bae (diff)
downloadgitlab-ce-df3ae4ef134e32ea2f5421c163a65784fd41a6db.tar.gz
Merge branch 'rs-issue-2970' into 'master'
Normalize space-like characters in keys before output to gitlab-shell gitlab-shell expects only one tab separator per key, and an SSH key with a tab character in the comment, for example, would break things. Closes #2970 See merge request !1552
Diffstat (limited to 'lib')
-rw-r--r--lib/gitlab/backend/shell.rb3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/gitlab/backend/shell.rb b/lib/gitlab/backend/shell.rb
index 14ee4701e7b..01b8bda05c6 100644
--- a/lib/gitlab/backend/shell.rb
+++ b/lib/gitlab/backend/shell.rb
@@ -4,7 +4,8 @@ module Gitlab
class KeyAdder < Struct.new(:io)
def add_key(id, key)
- io.puts("#{id}\t#{key.strip}")
+ key.gsub!(/[[:space:]]+/, ' ').strip!
+ io.puts("#{id}\t#{key}")
end
end