diff options
author | Michael Kozono <mkozono@gmail.com> | 2017-05-18 16:23:05 -0700 |
---|---|---|
committer | Michael Kozono <mkozono@gmail.com> | 2017-05-19 09:13:27 -0700 |
commit | 49697bc8df613dfe8e88f5f7cd8eae57e26c786f (patch) | |
tree | da5888be64878d8b35d1727dc802d609960fd631 /app/controllers/projects/application_controller.rb | |
parent | f9785dcec34c4205732871523f95b9743db00965 (diff) | |
download | gitlab-ce-49697bc8df613dfe8e88f5f7cd8eae57e26c786f.tar.gz |
Refactor to more robust implementationfix-issue-32506
In order to avoid string manipulation or modify route params (to make them unambiguous for `url_for`), we are accepting a behavior change:
When being redirected to the canonical path for a group, if you requested a group show path starting with `/groups/…` then you’ll now be redirected to the group at root `/…`.
Diffstat (limited to 'app/controllers/projects/application_controller.rb')
-rw-r--r-- | app/controllers/projects/application_controller.rb | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/app/controllers/projects/application_controller.rb b/app/controllers/projects/application_controller.rb index 12e4a6999ae..cb4bd0ad5f5 100644 --- a/app/controllers/projects/application_controller.rb +++ b/app/controllers/projects/application_controller.rb @@ -29,6 +29,13 @@ class Projects::ApplicationController < ApplicationController @project = find_routable!(Project, path, extra_authorization_proc: auth_proc) end + def build_canonical_path(project) + params[:namespace_id] = project.namespace.to_param + params[:project_id] = project.to_param + + url_for(params) + end + def repository @repository ||= project.repository end |