FIX: handle link tracking correctly for cdn based urls

(usually attachments)
This commit is contained in:
Sam
2015-08-05 12:15:08 +10:00
parent 54b780439d
commit a3c6cd7b38
2 changed files with 28 additions and 8 deletions

View File

@@ -122,6 +122,24 @@ describe TopicLinkClick do
ip: '127.0.0.3')
expect(url).to eq(nil)
# cdn better link track
path = "/uploads/site/29/5b585f848d8761d5.xls"
post = Fabricate(:post, topic: @topic, raw: "[test](#{path})")
TopicLink.extract_from(post)
url = TopicLinkClick.create_from(
url: "https://cdn.discourse.org/stuff#{path}",
topic_id: post.topic_id,
post_id: post.id,
ip: '127.0.0.3')
expect(url).to eq("https://cdn.discourse.org/stuff#{path}")
click = TopicLinkClick.order('id desc').first
expect(click.topic_link_id).to eq(TopicLink.order('id desc').first.id)
end
end