FIX: tags canonical url can raise error or be wrong

This commit is contained in:
Neil Lalonde 2017-01-05 15:17:23 -05:00
parent 7c8095294d
commit 685e6bdbab

View File

@ -66,7 +66,8 @@ class TagsController < ::ApplicationController
@description_meta = I18n.t("rss_by_tag", tag: tag_params.join(' & '))
@title = @description_meta
canonical_url "#{Discourse.base_url_no_prefix}#{public_send(url_method(params.slice(:category, :parent_category)))}"
path_name = url_method(params.slice(:category, :parent_category))
canonical_url "#{Discourse.base_url_no_prefix}#{public_send(path_name, *(params.slice(:parent_category, :category, :tag_id).values))}"
if @list.topics.size == 0 && params[:tag_id] != 'none' && !Tag.where(name: @tag_id).exists?
permalink_redirect_or_not_found