Skip to content

Commit c0ffca7

Browse files
committed
always render error templates as html
fixes CNVS-28641 test plan: - access an invalid url with a non-html format, like: "/courses/X.png" - it should only generate a "not found" error report, not a second error report about missing templates Change-Id: I6aaf4ec6363bf229175d1cfd626a0c565d729531 Reviewed-on: https://gerrit.instructure.com/76825 Reviewed-by: Cody Cutrer <cody@instructure.com> QA-Review: August Thornton <august@instructure.com> Tested-by: Jenkins Product-Review: Simon Williams <simon@instructure.com>
1 parent 129c4d9 commit c0ffca7

2 files changed

Lines changed: 8 additions & 0 deletions

File tree

app/controllers/application_controller.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1187,6 +1187,7 @@ def render_rescue_action(exception, error, status, status_code)
11871187
render template: template,
11881188
layout: 'application',
11891189
status: status_code,
1190+
formats: [:html],
11901191
locals: {
11911192
error: error,
11921193
exception: exception,

spec/integration/application_spec.rb

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,4 +195,11 @@
195195
end
196196
end
197197
end
198+
199+
context "error templates" do
200+
it "returns an html error page even for non-html requests" do
201+
Canvas::Errors.expects(:capture).once.returns({})
202+
get "/courses/blah.png"
203+
end
204+
end
198205
end

0 commit comments

Comments
 (0)