From 2794e57beb47677e51a40935dd59f7793de5ae85 Mon Sep 17 00:00:00 2001 From: "J. Daniel Schmidt" Date: Wed, 8 Apr 2015 10:51:36 +0200 Subject: [PATCH 1/3] clean_path should not drop the last character Fixes https://github.com/gitlabhq/gitlabhq/issues/9098 --- app/models/namespace.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/namespace.rb b/app/models/namespace.rb index dd74165f887..fcce8b46dfe 100644 --- a/app/models/namespace.rb +++ b/app/models/namespace.rb @@ -62,7 +62,7 @@ class Namespace < ActiveRecord::Base path.gsub!(/@.*\z/, "") path.gsub!(/\.git\z/, "") path.gsub!(/\A-/, "") - path.gsub!(/.\z/, "") + path.gsub!(/\.\z/, "") path.gsub!(/[^a-zA-Z0-9_\-\.]/, "") counter = 0 From 706be563179c8842a9370b40c52a79256534d2a5 Mon Sep 17 00:00:00 2001 From: "J. Daniel Schmidt" Date: Wed, 8 Apr 2015 15:50:38 +0200 Subject: [PATCH 2/3] clean_path should drop all trailing dots, not just one --- app/models/namespace.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/namespace.rb b/app/models/namespace.rb index fcce8b46dfe..8d9a85750ec 100644 --- a/app/models/namespace.rb +++ b/app/models/namespace.rb @@ -62,7 +62,7 @@ class Namespace < ActiveRecord::Base path.gsub!(/@.*\z/, "") path.gsub!(/\.git\z/, "") path.gsub!(/\A-/, "") - path.gsub!(/\.\z/, "") + path.gsub!(/\.+\z/, "") path.gsub!(/[^a-zA-Z0-9_\-\.]/, "") counter = 0 From d03cec0e697418482890f943dd5424e7a8a170be Mon Sep 17 00:00:00 2001 From: "J. Daniel Schmidt" Date: Wed, 8 Apr 2015 15:53:07 +0200 Subject: [PATCH 3/3] clean_path should drop all leading dashes, not just one --- app/models/namespace.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/namespace.rb b/app/models/namespace.rb index 8d9a85750ec..a0d79d7e5c0 100644 --- a/app/models/namespace.rb +++ b/app/models/namespace.rb @@ -61,7 +61,7 @@ class Namespace < ActiveRecord::Base def clean_path(path) path.gsub!(/@.*\z/, "") path.gsub!(/\.git\z/, "") - path.gsub!(/\A-/, "") + path.gsub!(/\A-+/, "") path.gsub!(/\.+\z/, "") path.gsub!(/[^a-zA-Z0-9_\-\.]/, "")