summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGo MAEDA <maeda@farend.jp>2020-07-09 00:33:41 +0000
committerGo MAEDA <maeda@farend.jp>2020-07-09 00:33:41 +0000
commit09db3e7131755ad10c615c38d7674f97c3212f62 (patch)
tree0ae9afe7cdda35fd89d434df558ee76b14008d47
parent8d2d557f2cda822fb32edcc9d1fdf3604e3dcfb7 (diff)
downloadredmine-09db3e7131755ad10c615c38d7674f97c3212f62.tar.gz
redmine-09db3e7131755ad10c615c38d7674f97c3212f62.zip
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
-rw-r--r--app/views/welcome/robots.text.erb2
-rw-r--r--test/integration/welcome_test.rb2
2 files changed, 4 insertions, 0 deletions
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