mirror of
https://github.com/discourse/discourse.git
synced 2025-05-21 18:12:32 +08:00
Fix a case where a random topic with null slug will be rendered instead of 404
This commit is contained in:
@ -29,7 +29,7 @@ class TopicsController < ApplicationController
|
||||
begin
|
||||
@topic_view = TopicView.new(params[:id] || params[:topic_id], current_user, opts)
|
||||
rescue Discourse::NotFound
|
||||
topic = Topic.where(slug: params[:id]).first
|
||||
topic = Topic.where(slug: params[:id]).first if params[:id]
|
||||
raise Discourse::NotFound unless topic
|
||||
return redirect_to(topic.relative_url)
|
||||
end
|
||||
|
Reference in New Issue
Block a user