diff options
author | Stan Hu <stanhu@gmail.com> | 2019-07-26 21:01:41 +0000 |
---|---|---|
committer | Stan Hu <stanhu@gmail.com> | 2019-07-26 21:01:41 +0000 |
commit | 2219b140b6873b893a3cac2cae195b929a20f5aa (patch) | |
tree | f69b0064f5aa05e5225c6920709837873ee62b5f /config | |
parent | 195c85eb3a1fb9f904d2ade69a23f5d3c884f502 (diff) | |
parent | 634a03bf608eaf86ecf14b4f44fa30e62905ac6b (diff) | |
download | gitlab-ce-2219b140b6873b893a3cac2cae195b929a20f5aa.tar.gz |
Merge branch '19186-redirect-wiki-git-route-to-wiki' into 'master'
Redirect project.wiki.git to project wiki home
See merge request gitlab-org/gitlab-ce!31085
Diffstat (limited to 'config')
-rw-r--r-- | config/routes/git_http.rb | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/config/routes/git_http.rb b/config/routes/git_http.rb index a959d40881b..aac6d418a92 100644 --- a/config/routes/git_http.rb +++ b/config/routes/git_http.rb @@ -34,6 +34,18 @@ scope(path: '*namespace_id/:project_id', end end + # Redirect /group/project.wiki.git to the project wiki + scope(format: true, constraints: { project_id: Gitlab::PathRegex.project_wiki_git_route_regex, format: :git }) do + wiki_redirect = redirect do |params, request| + project_id = params[:project_id].delete_suffix('.wiki') + path = [params[:namespace_id], project_id, 'wikis'].join('/') + path << "?#{request.query_string}" unless request.query_string.blank? + path + end + + get '/', to: wiki_redirect + end + # Redirect /group/project/info/refs to /group/project.git/info/refs scope(constraints: { project_id: Gitlab::PathRegex.project_route_regex }) do # Allow /info/refs, /info/refs?service=git-upload-pack, and |