Skip to content

Commit c80c7f1

Browse files
committed
Fix robots.txt to disallow issue lists with a sort or query_id parameter in any position, not just first (#38201).
Patch by Felix Schäfer. git-svn-id: https://svn.redmine.org/redmine/trunk@22070 e93f8b46-1217-0410-a6f0-8f06a7374b81
1 parent 0558568 commit c80c7f1

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

app/views/welcome/robots.text.erb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ Disallow: <%= url_for(issues_gantt_path) %>
1313
Disallow: <%= url_for(issues_calendar_path) %>
1414
Disallow: <%= url_for(activity_path) %>
1515
Disallow: <%= url_for(search_path) %>
16-
Disallow: <%= url_for(issues_path(:sort => '')) %>
17-
Disallow: <%= url_for(issues_path(:query_id => '')) %>
16+
Disallow: <%= url_for(issues_path) %>?*sort=
17+
Disallow: <%= url_for(issues_path) %>?*query_id=
1818
Disallow: <%= url_for(issues_path) %>?*set_filter=
1919
Disallow: <%= url_for(issues_path(:trailing_slash => true)) %>*.pdf$
2020
Disallow: <%= url_for(projects_path(:trailing_slash => true)) %>*.pdf$

test/integration/welcome_test.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ def test_robots
3131
assert_equal 'text/plain', @response.media_type
3232
# Redmine::Utils.relative_url_root does not effect on Rails 5.1.4.
3333
assert @response.body.match(%r{^Disallow: /projects/ecookbook/issues\r?$})
34-
assert @response.body.match(%r{^Disallow: /issues\?sort=\r?$})
34+
assert @response.body.match(%r{^Disallow: /issues\?\*sort=\r?$})
3535
assert @response.body.match(%r{^Disallow: /issues\?\*set_filter=\r?$})
3636
assert @response.body.match(%r{^Disallow: /issues/\*\.pdf\$\r?$})
3737
assert @response.body.match(%r{^Disallow: /projects/\*\.pdf\$\r?$})

0 commit comments

Comments
 (0)