diff options
author | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2016-11-17 20:00:03 +0100 |
---|---|---|
committer | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2016-11-17 20:00:03 +0100 |
commit | 8a7860fd7fe91a9d2642dab9e66be5b22012901d (patch) | |
tree | 8215c73a6f4d648b98bf5a7d47be1fd70afd1c29 /app/models/key.rb | |
parent | 4dbed5a249265b3690888b3fcfc91da44412f7f1 (diff) | |
parent | 726a414169e6c3219ff4fd410da3efd53fc7f912 (diff) | |
download | gitlab-ce-8a7860fd7fe91a9d2642dab9e66be5b22012901d.tar.gz |
Merge branch 'master' into 22539-display-folders
* master: (154 commits)
Fix typos
Fix wrong changelog item
Add missing item for 8.13.6
Change last_used_at to use touch
Add chat_name partial
Mention Git strategy none
Fix code review
adds fix for security issue when annonymous user does not ...
Remove ToC since it's now supported in the docs portal itself
Add 8.14 to versions with further additions to review apps
Add Limitations sections to environments and review apps docs
Add link to environments docs
Fix URL to review apps docs
Add a prerequisites section, add some links
Link to NGINX example project for the time being
Get rid most of the irrelevant sections
Add note about current limitation in $CI_BUILD_REF_NAME
Add an intro and an Overview section for Review Apps
WIP review apps
Add Review apps link to CI README
...
Conflicts:
spec/features/environments_spec.rb
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 568a60b8af3..ff8dda2dc89 100644 --- a/app/models/key.rb +++ b/app/models/key.rb @@ -6,7 +6,7 @@ class Key < ActiveRecord::Base belongs_to :user - before_validation :strip_white_space, :generate_fingerprint + before_validation :generate_fingerprint validates :title, presence: true, length: { within: 0..255 } validates :key, presence: true, length: { within: 0..5000 }, format: { with: /\A(ssh|ecdsa)-.*\Z/ } @@ -21,8 +21,9 @@ class Key < ActiveRecord::Base after_destroy :remove_from_shell after_destroy :post_destroy_hook - def strip_white_space - self.key = key.strip unless key.blank? + def key=(value) + value.strip! unless value.blank? + write_attribute(:key, value) end def publishable_key |