mirror of
https://github.com/discourse/discourse.git
synced 2025-05-28 13:39:28 +08:00
FIX: Improve handling of 'PublicExceptions' when bootstrap_error_pages enabled (#26700)
- Run the CSP-nonce-related middlewares on the generated response - Fix the readonly mode checking to avoid empty strings being passed (the `check_readonly_mode` before_action will not execute in the case of these re-dispatched exceptions) - Move the BlockRequestsMiddleware cookie-setting to the middleware, so that it is included even for unusual HTML responses like these exceptions
This commit is contained in:
19
spec/system/bootstrap_error_pages_spec.rb
Normal file
19
spec/system/bootstrap_error_pages_spec.rb
Normal file
@ -0,0 +1,19 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
describe "bootstrap_error_pages", type: :system do
|
||||
before { SiteSetting.bootstrap_error_pages = true }
|
||||
|
||||
it "boots ember for non-existent route" do
|
||||
visit "/foobar"
|
||||
expect(page).not_to have_css("body.no-ember")
|
||||
expect(page).to have_css("#site-logo")
|
||||
expect(page).to have_css("div.page-not-found")
|
||||
end
|
||||
|
||||
it "boots ember for non-existent topic" do
|
||||
visit "/t/999999999999"
|
||||
expect(page).not_to have_css("body.no-ember")
|
||||
expect(page).to have_css("#site-logo")
|
||||
expect(page).to have_css("div.page-not-found")
|
||||
end
|
||||
end
|
Reference in New Issue
Block a user