From 69b41ba04331e95739b25c77b3f5f198c0e64bae Mon Sep 17 00:00:00 2001 From: Robert Speicher Date: Thu, 8 Oct 2015 20:34:50 -0400 Subject: 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 --- lib/gitlab/backend/shell.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'lib') 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 -- cgit v1.2.1