summaryrefslogtreecommitdiffstats
path: root/app/models
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2015-04-11 06:27:54 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2015-04-11 06:27:54 +0000
commit5cd29b1a6b042082625867d2b96828e564a60a92 (patch)
tree5ed9a271fa0bc0f0312e5c34e03a2ccdb387a5a2 /app/models
parenta769aedb449218ed618c0bdddc4668eb4c11b3ff (diff)
downloadredmine-5cd29b1a6b042082625867d2b96828e564a60a92.tar.gz
redmine-5cd29b1a6b042082625867d2b96828e564a60a92.zip
Fixed that 2 repositories can be created with blank/nil identifier (#19400).
git-svn-id: http://svn.redmine.org/redmine/trunk@14156 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/models')
-rw-r--r--app/models/repository.rb5
1 files changed, 5 insertions, 0 deletions
diff --git a/app/models/repository.rb b/app/models/repository.rb
index 83c5b7c5c..3a911cd5d 100644
--- a/app/models/repository.rb
+++ b/app/models/repository.rb
@@ -30,6 +30,7 @@ class Repository < ActiveRecord::Base
serialize :extra_info
+ before_validation :normalize_identifier
before_save :check_default
# Raw SQL to delete changesets and changes in the database
@@ -469,6 +470,10 @@ class Repository < ActiveRecord::Base
end
end
+ def normalize_identifier
+ self.identifier = identifier.to_s.strip
+ end
+
def check_default
if !is_default? && set_as_default?
self.is_default = true