diff --git a/app/controllers/tag_controller.rb b/app/controllers/tag_controller.rb index e3fa74b7f1..697fbb1193 100644 --- a/app/controllers/tag_controller.rb +++ b/app/controllers/tag_controller.rb @@ -73,8 +73,12 @@ def index end def show - @wiki = Node.where(path: "/wiki/#{params[:id]}").try(:first) || Node.where(path: "/#{params[:id]}").try(:first) - @wiki = Node.where(slug: @wiki.power_tag('redirect'))&.first if @wiki&.has_power_tag('redirect') # use a redirected wiki page if it exists + if params[:id].is_a? Integer + @wiki = Node.find(params[:id])&.first + else + @wiki = Node.where(path: "/wiki/#{params[:id]}").try(:first) || Node.where(path: "/#{params[:id]}").try(:first) + @wiki = Node.where(slug: @wiki.power_tag('redirect'))&.first if @wiki&.has_power_tag('redirect') # use a redirected wiki page if it exists + end default_type = params[:id].match?('question:') ? 'questions' : 'note'