Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorNick Thomas <nick@gitlab.com>2019-02-25 13:41:50 +0300
committerRémy Coutable <remy@rymai.me>2019-02-26 14:21:57 +0300
commitafd290a444d09e84092e5a5d738bcf28ec71f3c6 (patch)
tree0119e5f4378d6ae8186517c8709b5f9729fcc9d7 /lib
parentb0097199a329c4de4eacc99a7d46d62c4ec0a1e0 (diff)
Merge branch 'sh-fix-cpp-templates-404' into 'master'
Fix 404s when C++ .gitignore template selected Closes #57857 See merge request gitlab-org/gitlab-ce!25416
Diffstat (limited to 'lib')
-rw-r--r--lib/api/project_templates.rb5
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/api/project_templates.rb b/lib/api/project_templates.rb
index d05ddad7466..119902a189c 100644
--- a/lib/api/project_templates.rb
+++ b/lib/api/project_templates.rb
@@ -36,7 +36,10 @@ module API
optional :project, type: String, desc: 'The project name to use when expanding placeholders in the template. Only affects licenses'
optional :fullname, type: String, desc: 'The full name of the copyright holder to use when expanding placeholders in the template. Only affects licenses'
end
- get ':id/templates/:type/:name', requirements: { name: /[\w\.-]+/ } do
+ # The regex is needed to ensure a period (e.g. agpl-3.0)
+ # isn't confused with a format type. We also need to allow encoded
+ # values (e.g. C%2B%2B for C++), so allow % and + as well.
+ get ':id/templates/:type/:name', requirements: { name: /[\w%.+-]+/ } do
template = TemplateFinder
.build(params[:type], user_project, name: params[:name])
.execute