From 1abc82f53f71f7f98fbecd66e645a537878b9170 Mon Sep 17 00:00:00 2001 From: Holger Just Date: Wed, 25 Oct 2023 16:12:56 +0200 Subject: [PATCH] Redirect to repositories#show after repository#fetch_changesets to avoid the user-visible browser URL --- app/controllers/repositories_controller.rb | 6 +++++- test/functional/repositories_controller_test.rb | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/app/controllers/repositories_controller.rb b/app/controllers/repositories_controller.rb index 3fb69e8b20..b362bc1528 100644 --- a/app/controllers/repositories_controller.rb +++ b/app/controllers/repositories_controller.rb @@ -103,7 +103,11 @@ def show def fetch_changesets @repository.fetch_changesets if @project.active? && @path.empty? && !Setting.autofetch_changesets? - show + + redirect_to( + controller: :repositories, action: :show, + id: @project, repository_id: @repository.identifier_param + ) end def changes diff --git a/test/functional/repositories_controller_test.rb b/test/functional/repositories_controller_test.rb index 17d9a50c4c..779d7d63d2 100644 --- a/test/functional/repositories_controller_test.rb +++ b/test/functional/repositories_controller_test.rb @@ -237,7 +237,7 @@ def test_fetch_changesets role.add_permission! :manage_repository Repository::Subversion.any_instance.expects(:fetch_changesets).once post(:fetch_changesets, :params => {:id => 1, :repository_id => 10}) - assert_response :success + assert_redirected_to '/projects/ecookbook/repository/10' role.remove_permission! :manage_repository Repository::Subversion.any_instance.expects(:fetch_changesets).never -- 2.39.2