summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorIan Baum <ibaum@gitlab.com>2018-02-12 19:05:31 +0000
committerIan Baum <ibaum@gitlab.com>2018-02-12 19:05:31 +0000
commit3f4662d3486e32ed80f1a068c74371a3db33429f (patch)
treeb4f7007e3891482cef0add7aafd4d083ca10da4d /app
parentbbfec704f7ed964807f2c14cac51ef8d0f9ff417 (diff)
parent740499bab5524d490218fd36033402cf67ec49f0 (diff)
downloadgitlab-ce-3f4662d3486e32ed80f1a068c74371a3db33429f.tar.gz
Merge branch 'rd-43185-revert-sanitize-extra-blank-spaces-used-when-uploading-a-ssh-key' into 'master'
Revert "Merge branch 'rd-40552-gitlab-should-check-if-keys-are-valid-before-saving' into 'master'" See merge request gitlab-org/gitlab-ce!17062
Diffstat (limited to 'app')
-rw-r--r--app/models/key.rb7
1 files changed, 4 insertions, 3 deletions
diff --git a/app/models/key.rb b/app/models/key.rb
index ae5769c0627..7406c98c99e 100644
--- a/app/models/key.rb
+++ b/app/models/key.rb
@@ -33,8 +33,9 @@ class Key < ActiveRecord::Base
after_destroy :refresh_user_cache
def key=(value)
- write_attribute(:key, value.present? ? Gitlab::SSHPublicKey.sanitize(value) : nil)
-
+ value&.delete!("\n\r")
+ value.strip! unless value.blank?
+ write_attribute(:key, value)
@public_key = nil
end
@@ -96,7 +97,7 @@ class Key < ActiveRecord::Base
def generate_fingerprint
self.fingerprint = nil
- return unless public_key.valid?
+ return unless self.key.present?
self.fingerprint = public_key.fingerprint
end