Skip to content

Fix regexp matching when using API with group/project syntax

Stan Hu requested to merge fix-archive-api-for-project-names into master

Projects can be specified in two ways:

  1. Project ID integer (e.g. 142)
  2. Project group/name (e.g. group%2Fproject)

Here's the issue: by the time gitlab-workhorse receives the query, the %2F is decoded into a slash, and so gitlab-workhorse sees:

/api/v3/projects/:group_name/:project_name/repository/archive

In 0.4.2, the regex just attempted to match the last part of the URL: repository/archive. In 0.5.0, the anchor ^ forces the API endpoint regexp to match the following form:

/api/v3/projects/:project_id/repository/archive

The extra slash throws the regexp off and causes gitlab-workhorse to forward the request along.

Closes gitlab-org/gitlab-ce#4124

Merge request reports