Project

General

Profile

Actions

Defect #40208

closed

An ActionController::RespondToMismatchError occurred in welcome#robots

Added by Liane Hampe 11 months ago. Updated 11 months ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
SEO
Target version:
Start date:
Due date:
% Done:

0%

Estimated time:
Resolution:
Fixed
Affected version:

Description

Problem

Requesting the robots file via `https://<domain>.tld/robots` raises an error:

respond_to was called multiple times and matched with conflicting formats in this action. Please note that you may only call respond_to and match on a single format per action.
  app/controllers/application_controller.rb:592:in `render_error'

Requesting the robots file via `https://<domain>.tld/robots.txt` works as expected.

This behavior is the same for all Redmine versions.

Solution

In order to make the request of the robots file more stable we could slightly change the route definition to allow both the request with and without format :

# current definition
get 'robots', :to => 'welcome#robots'

# modified definition
get 'robots', :to => 'welcome#robots', :defaults => { format: 'txt' }

The attached patch file implements this change and considers testing too.


Files

fix_robots_route.patch (1.65 KB) fix_robots_route.patch Liane Hampe, 2024-02-07 13:21
40208-v2.patch (1.02 KB) 40208-v2.patch Go MAEDA, 2024-02-08 13:08
Actions

Also available in: Atom PDF