From 4bc5c66fe12a2dc5d8fe9ed5878da5dea2444442 Mon Sep 17 00:00:00 2001 From: Stan Hu Date: Sun, 1 Mar 2015 20:15:59 -0800 Subject: [PATCH 1/2] Fix broken `project_url` routing when protected branches are accessed with an empty repo --- app/helpers/gitlab_routing_helper.rb | 16 ++++++++++++++++ .../protected_branches_controller_spec.rb | 10 ++++++++++ 2 files changed, 26 insertions(+) create mode 100644 spec/controllers/projects/protected_branches_controller_spec.rb diff --git a/app/helpers/gitlab_routing_helper.rb b/app/helpers/gitlab_routing_helper.rb index f0eb50a0e17..ac37f909ce9 100644 --- a/app/helpers/gitlab_routing_helper.rb +++ b/app/helpers/gitlab_routing_helper.rb @@ -28,4 +28,20 @@ module GitlabRoutingHelper def merge_request_path(entity, *args) namespace_project_merge_request_path(entity.project.namespace, entity.project, entity, *args) end + + def project_url(project, *args) + namespace_project_url(project.namespace, project, *args) + end + + def edit_project_url(project, *args) + edit_namespace_project_url(project.namespace, project, *args) + end + + def issue_url(entity, *args) + namespace_project_issue_url(entity.project.namespace, entity.project, entity, *args) + end + + def merge_request_url(entity, *args) + namespace_project_merge_request_url(entity.project.namespace, entity.project, entity, *args) + end end diff --git a/spec/controllers/projects/protected_branches_controller_spec.rb b/spec/controllers/projects/protected_branches_controller_spec.rb new file mode 100644 index 00000000000..596d8d34b7c --- /dev/null +++ b/spec/controllers/projects/protected_branches_controller_spec.rb @@ -0,0 +1,10 @@ +require('spec_helper') + +describe Projects::ProtectedBranchesController do + describe "GET #index" do + let(:project) { create(:project_empty_repo, :public) } + it "redirect empty repo to projects page" do + get(:index, namespace_id: project.namespace.to_param, project_id: project.to_param) + end + end +end From 8d0690c5c768415a5dae1155c236f7650ea894cf Mon Sep 17 00:00:00 2001 From: Nicolas Bouilleaud Date: Wed, 17 Dec 2014 15:26:43 +0100 Subject: [PATCH 2/2] Support names starting with a digit or _ for projects and users MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This is what’s actually allowed when creating a user or a project in gitlab. --- CHANGELOG | 1 + lib/gitlab/markdown.rb | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG b/CHANGELOG index dae32953cd9..6bd93b8cd4b 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -23,6 +23,7 @@ v 7.8.1 - Fix urls for the issues when relative url was enabled - Add Bitbucket omniauth provider. - Add Bitbucket importer. + - Support referencing issues to a project whose name starts with a digit v 7.8.0 - Fix access control and protection against XSS for note attachments and other uploads. diff --git a/lib/gitlab/markdown.rb b/lib/gitlab/markdown.rb index a1fd794aed2..d85c2ee4f2d 100644 --- a/lib/gitlab/markdown.rb +++ b/lib/gitlab/markdown.rb @@ -121,7 +121,7 @@ module Gitlab text end - NAME_STR = '[a-zA-Z][a-zA-Z0-9_\-\.]*' + NAME_STR = '[a-zA-Z0-9_][a-zA-Z0-9_\-\.]*' PROJ_STR = "(?#{NAME_STR}/#{NAME_STR})" REFERENCE_PATTERN = %r{