diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-12-20 14:22:11 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-12-20 14:22:11 +0000 |
commit | 0c872e02b2c822e3397515ec324051ff540f0cd5 (patch) | |
tree | ce2fb6ce7030e4dad0f4118d21ab6453e5938cdd /app/controllers/concerns/routable_actions.rb | |
parent | f7e05a6853b12f02911494c4b3fe53d9540d74fc (diff) | |
download | gitlab-ce-15.7.0-rc42.tar.gz |
Add latest changes from gitlab-org/gitlab@15-7-stable-eev15.7.0-rc42
Diffstat (limited to 'app/controllers/concerns/routable_actions.rb')
-rw-r--r-- | app/controllers/concerns/routable_actions.rb | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/app/controllers/concerns/routable_actions.rb b/app/controllers/concerns/routable_actions.rb index e34d6b09c24..28e1fa473b3 100644 --- a/app/controllers/concerns/routable_actions.rb +++ b/app/controllers/concerns/routable_actions.rb @@ -46,13 +46,13 @@ module RoutableActions return unless request.get? canonical_path = routable.full_path - if canonical_path != routable_full_path - if !request.xhr? && request.format.html? && canonical_path.casecmp(routable_full_path) != 0 - flash[:notice] = "#{routable.class.to_s.titleize} '#{routable_full_path}' was moved to '#{canonical_path}'. Please update any links and bookmarks that may still have the old path." - end + return unless canonical_path != routable_full_path - redirect_to build_canonical_path(routable), status: :moved_permanently + if !request.xhr? && request.format.html? && canonical_path.casecmp(routable_full_path) != 0 + flash[:notice] = "#{routable.class.to_s.titleize} '#{routable_full_path}' was moved to '#{canonical_path}'. Please update any links and bookmarks that may still have the old path." end + + redirect_to build_canonical_path(routable), status: :moved_permanently end end |