diff options
author | Rubén Dávila <ruben@gitlab.com> | 2018-02-12 20:39:47 +0300 |
---|---|---|
committer | Rubén Dávila <ruben@gitlab.com> | 2018-02-12 20:39:47 +0300 |
commit | 740499bab5524d490218fd36033402cf67ec49f0 (patch) | |
tree | f1d0f12360823fc75b79fe873d1c7f89bdf66bf9 /app/models/key.rb | |
parent | 80c1626b2776b300acaaee85d11012b96893d004 (diff) |
Revert "Merge branch 'rd-40552-gitlab-should-check-if-keys-are-valid-before-saving' into 'master'"
This reverts commit a58f8c32c62bcf5824d1fe1d0de53e9bda974d65, reversing
changes made to cd5d75c362cdf06efb8174eddfbd0f4b65687dec.
Diffstat (limited to 'app/models/key.rb')
-rw-r--r-- | app/models/key.rb | 7 |
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 |