##// END OF EJS Templates
Respond with 404 on ActionView::MissingTemplate (#11503)....
Jean-Philippe Lang -
r10021:327660eb7f7e
parent child
Show More
@@ -39,6 +39,7 class ApplicationController < ActionController::Base
39 39
40 40 rescue_from ActionController::InvalidAuthenticityToken, :with => :invalid_authenticity_token
41 41 rescue_from ::Unauthorized, :with => :deny_access
42 rescue_from ::ActionView::MissingTemplate, :with => :missing_template
42 43
43 44 include Redmine::Search::Controller
44 45 include Redmine::MenuManager::MenuController
@@ -352,13 +353,17 class ApplicationController < ActionController::Base
352 353 format.html {
353 354 render :template => 'common/error', :layout => use_layout, :status => @status
354 355 }
355 format.atom { head @status }
356 format.xml { head @status }
357 format.js { head @status }
358 format.json { head @status }
356 format.any { head @status }
359 357 end
360 358 end
361
359
360 # Handler for ActionView::MissingTemplate exception
361 def missing_template
362 logger.warn "Missing template, responding with 404"
363 @project = nil
364 render_404
365 end
366
362 367 # Filter for actions that provide an API response
363 368 # but have no HTML representation for non admin users
364 369 def require_admin_or_api_request
@@ -60,4 +60,9 class ApplicationTest < ActionController::IntegrationTest
60 60 assert_response 200
61 61 assert_nil session[:user_id]
62 62 end
63
64 def test_missing_template_should_respond_with_404
65 get '/login.png'
66 assert_response 404
67 end
63 68 end
General Comments 0
You need to be logged in to leave comments. Login now