From: Go MAEDA Date: Thu, 9 Jul 2020 00:33:41 +0000 (+0000) Subject: robots.txt: disallow crawling dynamically generated PDF documents (#31617). X-Git-Tag: 4.2.0~930 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=09db3e7131755ad10c615c38d7674f97c3212f62;p=redmine.git robots.txt: disallow crawling dynamically generated PDF documents (#31617). Patch by Go MAEDA. git-svn-id: http://svn.redmine.org/redmine/trunk@19867 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- diff --git a/app/views/welcome/robots.text.erb b/app/views/welcome/robots.text.erb index 16acc8111..7516fea5d 100644 --- a/app/views/welcome/robots.text.erb +++ b/app/views/welcome/robots.text.erb @@ -13,3 +13,5 @@ Disallow: <%= url_for(search_path) %> Disallow: <%= url_for(issues_path(:sort => '')) %> Disallow: <%= url_for(issues_path(:query_id => '')) %> Disallow: <%= url_for(issues_path) %>?*set_filter= +Disallow: <%= url_for(issues_path(:trailing_slash => true)) %>*.pdf$ +Disallow: <%= url_for(projects_path(:trailing_slash => true)) %>*.pdf$ diff --git a/test/integration/welcome_test.rb b/test/integration/welcome_test.rb index e28e97ba5..a526a8cec 100644 --- a/test/integration/welcome_test.rb +++ b/test/integration/welcome_test.rb @@ -31,5 +31,7 @@ class WelcomeTest < Redmine::IntegrationTest assert @response.body.match(%r{^Disallow: /projects/ecookbook/issues\r?$}) assert @response.body.match(%r{^Disallow: /issues\?sort=\r?$}) assert @response.body.match(%r{^Disallow: /issues\?\*set_filter=\r?$}) + assert @response.body.match(%r{^Disallow: /issues/\*\.pdf\$\r?$}) + assert @response.body.match(%r{^Disallow: /projects/\*\.pdf\$\r?$}) end end