mirror of
https://github.com/discourse/discourse.git
synced 2025-05-22 20:41:24 +08:00
FIX: More encoded slug fixes (#8191)
* FIX: Do not encode the URL twice Now that we encode slugs in the server we don't need this anymore. Reverts fe5na33 * FIX: More places do deal with encoded slugs * the param is a string now, not a hash * FIX: Handle the nil slug on /categories * DEV: Add seeded? method to identity default categories * DEV: Use SiteSetting to keep track of seeded categories
This commit is contained in:

committed by
GitHub

parent
7a0c06691c
commit
6e9c8fe854
@ -36,7 +36,7 @@ class TopicsController < ApplicationController
|
||||
skip_before_action :check_xhr, only: [:show, :feed]
|
||||
|
||||
def id_for_slug
|
||||
topic = Topic.find_by(slug: params[:slug].downcase)
|
||||
topic = Topic.find_by_slug(params[:slug])
|
||||
guardian.ensure_can_see!(topic)
|
||||
raise Discourse::NotFound unless topic
|
||||
render json: { slug: topic.slug, topic_id: topic.id, url: topic.url }
|
||||
@ -64,7 +64,7 @@ class TopicsController < ApplicationController
|
||||
# Special case: a slug with a number in front should look by slug first before looking
|
||||
# up that particular number
|
||||
if params[:id] && params[:id] =~ /^\d+[^\d\\]+$/
|
||||
topic = Topic.find_by(slug: params[:id].downcase)
|
||||
topic = Topic.find_by_slug(params[:id])
|
||||
return redirect_to_correct_topic(topic, opts[:post_number]) if topic
|
||||
end
|
||||
|
||||
@ -81,7 +81,7 @@ class TopicsController < ApplicationController
|
||||
@topic_view = TopicView.new(params[:id] || params[:topic_id], current_user, opts)
|
||||
rescue Discourse::NotFound => ex
|
||||
if params[:id]
|
||||
topic = Topic.find_by(slug: params[:id].downcase)
|
||||
topic = Topic.find_by_slug(params[:id])
|
||||
return redirect_to_correct_topic(topic, opts[:post_number]) if topic
|
||||
end
|
||||
|
||||
|
Reference in New Issue
Block a user