diff options
author | Sean McGivern <sean@mcgivern.me.uk> | 2016-11-21 23:39:27 +0300 |
---|---|---|
committer | Alejandro RodrÃguez <alejorro70@gmail.com> | 2016-11-21 23:44:49 +0300 |
commit | 0c3cc083f0585bd71cafd1460666f3532ce03133 (patch) | |
tree | 38f7ea1afb0b7295061d7f47b8864eb33d70d875 | |
parent | 03ecf2cd88d7cdcda5df27d3b2267dcb8ef44db7 (diff) |
Merge branch 'dz-fix-500-group-git' into 'master'
Fix 500 error when group name ends with git
Closes https://gitlab.com/gitlab-com/support-forum/issues/1298
Closes https://gitlab.com/gitlab-org/gitlab-ce/issues/24742
See merge request !7630
-rw-r--r-- | changelogs/unreleased/dz-fix-500-group-git.yml | 4 | ||||
-rw-r--r-- | lib/gitlab/regex.rb | 2 | ||||
-rw-r--r-- | spec/routing/routing_spec.rb | 2 |
3 files changed, 6 insertions, 2 deletions
diff --git a/changelogs/unreleased/dz-fix-500-group-git.yml b/changelogs/unreleased/dz-fix-500-group-git.yml new file mode 100644 index 00000000000..38e80ad8bde --- /dev/null +++ b/changelogs/unreleased/dz-fix-500-group-git.yml @@ -0,0 +1,4 @@ +--- +title: Fix 500 error when group name ends with git +merge_request: 7630 +author: diff --git a/lib/gitlab/regex.rb b/lib/gitlab/regex.rb index 47ea8b7e82e..c12358ceef4 100644 --- a/lib/gitlab/regex.rb +++ b/lib/gitlab/regex.rb @@ -9,7 +9,7 @@ module Gitlab # `NAMESPACE_REGEX_STR`, with the negative lookbehind assertion removed. This means that the client-side validation # will pass for usernames ending in `.atom` and `.git`, but will be caught by the server-side validation. NAMESPACE_REGEX_STR_SIMPLE = '[a-zA-Z0-9_\.][a-zA-Z0-9_\-\.]*[a-zA-Z0-9_\-]|[a-zA-Z0-9_]'.freeze - NAMESPACE_REGEX_STR = "(?:#{NAMESPACE_REGEX_STR_SIMPLE})(?<!\.git|\.atom)".freeze + NAMESPACE_REGEX_STR = '(?:' + NAMESPACE_REGEX_STR_SIMPLE + ')(?<!\.git|\.atom)'.freeze def namespace_regex @namespace_regex ||= /\A#{NAMESPACE_REGEX_STR}\z/.freeze diff --git a/spec/routing/routing_spec.rb b/spec/routing/routing_spec.rb index 7aba4f08088..f15c45cbaac 100644 --- a/spec/routing/routing_spec.rb +++ b/spec/routing/routing_spec.rb @@ -261,7 +261,7 @@ describe "Authentication", "routing" do end describe "Groups", "routing" do - let(:name) { 'complex.group-name' } + let(:name) { 'complex.group-namegit' } it "to #show" do expect(get("/groups/#{name}")).to route_to('groups#show', id: name) |