diff --git a/config/routes.rb b/config/routes.rb index 221a1999f..7abda8934 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -11,7 +11,7 @@ get "healthcheck", to: proc { [200, {}, [""]] } - get "/government/uploads/*path" => "asset_manager_redirect#show", format: true + get "/government/uploads/*path" => "asset_manager_redirect#show", format: false get "*path/:variant" => "content_items#show", constraints: { diff --git a/test/controllers/asset_manager_redirect_controller_test.rb b/test/controllers/asset_manager_redirect_controller_test.rb index 61a4c15f3..b32bc2867 100644 --- a/test/controllers/asset_manager_redirect_controller_test.rb +++ b/test/controllers/asset_manager_redirect_controller_test.rb @@ -8,15 +8,22 @@ class AssetManagerRedirectControllerTest < ActionController::TestCase test "redirects asset requests made via public host to the public asset host" do request.host = "some-host.com" - get :show, params: { path: "asset", format: "txt" } + get :show, params: { path: "asset.txt" } assert_redirected_to "http://asset-host.com/government/uploads/asset.txt" end test "redirects asset requests made via draft host to the draft asset host" do request.host = "draft-some-host.com" - get :show, params: { path: "asset", format: "txt" } + get :show, params: { path: "asset.txt" } assert_redirected_to "http://draft-asset-host.com/government/uploads/asset.txt" end + + test "redirects asset preview requests made via public host to the public asset host" do + request.host = "some-host.com" + get :show, params: { path: "asset.csv/preview" } + + assert_redirected_to "http://asset-host.com/government/uploads/asset.csv/preview" + end end