summaryrefslogtreecommitdiff
path: root/db/migrate
diff options
context:
space:
mode:
authorDouwe Maan <douwe@gitlab.com>2015-04-21 12:00:08 +0200
committerDouwe Maan <douwe@gitlab.com>2015-04-24 14:49:23 +0200
commitfac1f83fd51d4d6cc6e8a0c571507bca4460b514 (patch)
treead8b78c99d39addeaa777a1750e7ecd5e96fca0b /db/migrate
parentc0116926c743818b2593474946abb40b56d8fefa (diff)
downloadgitlab-ce-fac1f83fd51d4d6cc6e8a0c571507bca4460b514.tar.gz
Properly migrate users with usernames like "." or "..".
Diffstat (limited to 'db/migrate')
-rw-r--r--db/migrate/20150324133047_remove_periods_at_ends_of_usernames.rb4
1 files changed, 4 insertions, 0 deletions
diff --git a/db/migrate/20150324133047_remove_periods_at_ends_of_usernames.rb b/db/migrate/20150324133047_remove_periods_at_ends_of_usernames.rb
index dc38b0eceb7..e2f231ba709 100644
--- a/db/migrate/20150324133047_remove_periods_at_ends_of_usernames.rb
+++ b/db/migrate/20150324133047_remove_periods_at_ends_of_usernames.rb
@@ -15,6 +15,10 @@ class RemovePeriodsAtEndsOfUsernames < ActiveRecord::Migration
path.gsub!(/\.+\z/, "")
path.gsub!(/[^a-zA-Z0-9_\-\.]/, "")
+ # Users with the great usernames of "." or ".." would end up with a blank username.
+ # Work around that by setting their username to "blank", followed by a counter.
+ path = "blank" if path.blank?
+
counter = 0
base = path
while Namespace.find_by_path_or_name(path)