FIX: do not replace hashtags in URLs

This commit is contained in:
Arpit Jalan
2018-05-17 00:34:17 +05:30
parent 6cd0b7316a
commit 2a9b4e4bb5

View File

@@ -66,15 +66,15 @@ class TwitterApi
def link_hashtags_in(text) def link_hashtags_in(text)
text.scan(/(?:^|\s)#(\w+)/).flatten.uniq.each do |hashtag| text.scan(/(?:^|\s)#(\w+)/).flatten.uniq.each do |hashtag|
text.gsub!("##{hashtag}", [ text.gsub!(/(?:^|\s)##{hashtag}/, [
"<a href='https://twitter.com/search?q=%23#{hashtag}' ", " <a href='https://twitter.com/search?q=%23#{hashtag}' ",
"target='_blank'>", "target='_blank'>",
"##{hashtag}", "##{hashtag}",
"</a>" "</a>"
].join) ].join)
end end
text text.strip
end end
def user_timeline_uri_for(screen_name) def user_timeline_uri_for(screen_name)