diff options
author | Luke Duncalfe <lduncalfe@eml.cc> | 2019-07-24 13:53:06 +1200 |
---|---|---|
committer | Luke Duncalfe <lduncalfe@eml.cc> | 2019-07-26 11:49:36 +1200 |
commit | 634a03bf608eaf86ecf14b4f44fa30e62905ac6b (patch) | |
tree | 4daf3593529dc95619cea5526c56e854770e3296 /config/routes | |
parent | 513daf3dd6e48fe935ce5f062f8ffd201aee1503 (diff) | |
download | gitlab-ce-634a03bf608eaf86ecf14b4f44fa30e62905ac6b.tar.gz |
Redirect project.wiki.git to project wiki home19186-redirect-wiki-git-route-to-wiki
https://gitlab.com/gitlab-org/gitlab-ce/issues/19186
Diffstat (limited to 'config/routes')
-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 |