diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2011-07-23 19:45:23 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2011-07-23 19:45:23 +0000 |
commit | fdd5367ebab20caf34013e06d266daef1ddb30e5 (patch) | |
tree | 22cbea562aaf92577080ccb7da8e6397f599cc3e /app/controllers/issues_controller.rb | |
parent | 2ce3191639dcbf3929ce2208a5edba96ba812a2c (diff) | |
download | redmine-fdd5367ebab20caf34013e06d266daef1ddb30e5.tar.gz redmine-fdd5367ebab20caf34013e06d266daef1ddb30e5.zip |
Respond with errors and appropriate content type on /issues API calls with invalid query params (#8883).
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@6309 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/controllers/issues_controller.rb')
-rw-r--r-- | app/controllers/issues_controller.rb | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/app/controllers/issues_controller.rb b/app/controllers/issues_controller.rb index 7e6510341..c8778b473 100644 --- a/app/controllers/issues_controller.rb +++ b/app/controllers/issues_controller.rb @@ -96,8 +96,10 @@ class IssuesController < ApplicationController format.pdf { send_data(issues_to_pdf(@issues, @project, @query), :type => 'application/pdf', :filename => 'export.pdf') } end else - # Send html if the query is not valid - render(:template => 'issues/index.rhtml', :layout => !request.xhr?) + respond_to do |format| + format.any(:html, :atom, :csv, :pdf) { render(:template => 'issues/index.rhtml', :layout => !request.xhr?) } + format.api { render_validation_errors(@query) } + end end rescue ActiveRecord::RecordNotFound render_404 |