From da79bdae456b3d9b292eca53f655b47a1c96db80 Mon Sep 17 00:00:00 2001 From: Go MAEDA Date: Fri, 9 Feb 2024 04:49:33 +0000 Subject: [PATCH] Merged r22698 from trunk to 5.1-stable (#40208). git-svn-id: https://svn.redmine.org/redmine/branches/5.1-stable@22699 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- config/routes.rb | 2 +- test/integration/welcome_test.rb | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/config/routes.rb b/config/routes.rb index 12be7b3ec..e5c81b580 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -404,7 +404,7 @@ Rails.application.routes.draw do match 'uploads', :to => 'attachments#upload', :via => :post - get 'robots', :to => 'welcome#robots' + get 'robots.:format', :to => 'welcome#robots', :constraints => {:format => 'txt'} Redmine::Plugin.directory.glob("*/config/routes.rb").sort.each do |plugin_routes_path| instance_eval(plugin_routes_path.read, plugin_routes_path.to_s) diff --git a/test/integration/welcome_test.rb b/test/integration/welcome_test.rb index d1b0c8889..4fff2827c 100644 --- a/test/integration/welcome_test.rb +++ b/test/integration/welcome_test.rb @@ -54,4 +54,11 @@ class WelcomeTest < Redmine::IntegrationTest assert @response.body.match(%r{^Disallow: /\r?$}) end end + + def test_robots_should_not_respond_to_formats_other_than_txt + %w(robots.json robots).each do |file| + get "/#{file}" + assert_response :not_found + end + end end -- 2.39.5