mirror of
https://github.com/discourse/discourse.git
synced 2025-05-22 22:43:33 +08:00
SECURITY: make find topic by slug adhere to SiteSetting.detailed_404 (#9898)
This commit is contained in:
@ -945,7 +945,15 @@ class TopicsController < ApplicationController
|
||||
end
|
||||
|
||||
def redirect_to_correct_topic(topic, post_number = nil)
|
||||
guardian.ensure_can_see!(topic)
|
||||
begin
|
||||
guardian.ensure_can_see!(topic)
|
||||
rescue Discourse::InvalidAccess => ex
|
||||
if !SiteSetting.detailed_404
|
||||
raise Discourse::NotFound
|
||||
else
|
||||
raise ex
|
||||
end
|
||||
end
|
||||
|
||||
url = topic.relative_url
|
||||
url << "/#{post_number}" if post_number.to_i > 0
|
||||
|
Reference in New Issue
Block a user