Commit a13bb5960eebdd9d1a23a532b45abf49bfa48d4d
1 parent
d486c3ff
Exists in
master
and in
20 other branches
rails4: force html rendering for 403/404
Showing
1 changed file
with
4 additions
and
2 deletions
Show diff stats
app/controllers/application_controller.rb
| ... | ... | @@ -157,7 +157,8 @@ class ApplicationController < ActionController::Base |
| 157 | 157 | def render_not_found(path = nil) |
| 158 | 158 | @no_design_blocks = true |
| 159 | 159 | @path ||= request.path |
| 160 | - render template: 'shared/not_found', status: 404, layout: get_layout | |
| 160 | + # force html template even if the browser asked for a image | |
| 161 | + render template: 'shared/not_found', status: 404, layout: get_layout, formats: [:html] | |
| 161 | 162 | end |
| 162 | 163 | alias :render_404 :render_not_found |
| 163 | 164 | |
| ... | ... | @@ -165,7 +166,8 @@ class ApplicationController < ActionController::Base |
| 165 | 166 | @no_design_blocks = true |
| 166 | 167 | @message = message |
| 167 | 168 | @title = title |
| 168 | - render template: 'shared/access_denied', status: 403 | |
| 169 | + # force html template even if the browser asked for a image | |
| 170 | + render template: 'shared/access_denied', status: 403, formats: [:html] | |
| 169 | 171 | end |
| 170 | 172 | |
| 171 | 173 | def load_category | ... | ... |