mirror of
https://github.com/discourse/discourse.git
synced 2025-09-06 10:50:21 +08:00
Revert "FIX: trim trailing slash from topic links"
This reverts commit 993f847a2c
.
There is an edge case where the link click redirect fails when the URL has trailing slash. Need to figure out a better fix for this.
This commit is contained in:
parent
c666ef556d
commit
d1597683f3
2 changed files with 2 additions and 2 deletions
|
@ -205,7 +205,7 @@ SQL
|
||||||
reflected_post = Post.find_by(topic_id: topic_id, post_number: post_number.to_i)
|
reflected_post = Post.find_by(topic_id: topic_id, post_number: post_number.to_i)
|
||||||
end
|
end
|
||||||
|
|
||||||
url = url[0...TopicLink.max_url_length]&.chomp("/")
|
url = url[0...TopicLink.max_url_length]
|
||||||
return nil if parsed && parsed.host && parsed.host.length > TopicLink.max_domain_length
|
return nil if parsed && parsed.host && parsed.host.length > TopicLink.max_domain_length
|
||||||
|
|
||||||
unless TopicLink.exists?(topic_id: post.topic_id, post_id: post.id, url: url)
|
unless TopicLink.exists?(topic_id: post.topic_id, post_id: post.id, url: url)
|
||||||
|
|
|
@ -41,7 +41,7 @@ describe TopicLink do
|
||||||
|
|
||||||
it 'works' do
|
it 'works' do
|
||||||
expect(topic.topic_links.pluck(:url)).to contain_exactly(
|
expect(topic.topic_links.pluck(:url)).to contain_exactly(
|
||||||
"http://a.com",
|
"http://a.com/",
|
||||||
"https://b.com/b",
|
"https://b.com/b",
|
||||||
"//b.com/#{'a' * 500}"[0...TopicLink.max_url_length]
|
"//b.com/#{'a' * 500}"[0...TopicLink.max_url_length]
|
||||||
)
|
)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue