]> source.dussan.org Git - redmine.git/commitdiff
Merged r22698 from trunk to 5.0-stable (#40208).
authorGo MAEDA <maeda@farend.jp>
Fri, 9 Feb 2024 04:51:05 +0000 (04:51 +0000)
committerGo MAEDA <maeda@farend.jp>
Fri, 9 Feb 2024 04:51:05 +0000 (04:51 +0000)
git-svn-id: https://svn.redmine.org/redmine/branches/5.0-stable@22700 e93f8b46-1217-0410-a6f0-8f06a7374b81

config/routes.rb
test/integration/welcome_test.rb

index ad7a44dc9d740148bd45d1ef84e0e90831d4381a..c80b75bec1d8aa1ab641cd82f3a351d50e80e4a1 100644 (file)
@@ -397,7 +397,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'}
 
   Dir.glob File.expand_path("#{Redmine::Plugin.directory}/*") do |plugin_dir|
     file = File.join(plugin_dir, "config/routes.rb")
index 2d360dd8b3d87c15696d4740c0b5e83dfa935f84..233d13f21271d0600c73e5597575e8eefe453aad 100644 (file)
@@ -37,4 +37,11 @@ class WelcomeTest < Redmine::IntegrationTest
     assert @response.body.match(%r{^Disallow: /account/register\r?$})
     assert @response.body.match(%r{^Disallow: /account/lost_password\r?$})
   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