FIX: Look up a url without the query string if it couldn't be found with it.

This commit is contained in:
Robin Ward
2013-12-13 12:56:20 -05:00
parent 26e75c5ceb
commit 06e9cbc6cb
2 changed files with 13 additions and 0 deletions

View File

@ -8,6 +8,12 @@ class ClicksController < ApplicationController
if params[:topic_id].present? || params[:post_id].present?
params.merge!({ user_id: current_user.id }) if current_user.present?
@redirect_url = TopicLinkClick.create_from(params)
if @redirect_url.blank? && params[:url].index('?')
# Check the url without query parameters
params[:url].sub!(/\?.*$/, '')
@redirect_url = TopicLinkClick.create_from(params)
end
end
# Sometimes we want to record a link without a 302. Since XHR has to load the redirected