mirror of
https://github.com/discourse/discourse.git
synced 2024-11-23 06:04:11 +08:00
FIX: don't extract links to anchors
This commit is contained in:
parent
fd93fff39b
commit
1a621f3393
|
@ -333,7 +333,7 @@ module PrettyText
|
|||
|
||||
# extract all links from the post
|
||||
doc.css("a").each { |l|
|
||||
unless l["href"].blank?
|
||||
unless l["href"].blank? || "#".freeze == l["href"][0]
|
||||
links << DetectedLink.new(l["href"])
|
||||
end
|
||||
}
|
||||
|
|
|
@ -208,6 +208,10 @@ HTML
|
|||
expect(extract_urls("<aside class=\"quote\" data-topic=\"1234\" data-post=\"4567\">aside</aside>")).to eq(["/t/topic/1234/4567"])
|
||||
end
|
||||
|
||||
it "should not extract links to anchors" do
|
||||
expect(extract_urls("<a href='#tos'>TOS</a>")).to eq([])
|
||||
end
|
||||
|
||||
it "should not extract links inside quotes" do
|
||||
links = PrettyText.extract_links("
|
||||
<a href='http://body_only.com'>http://useless1.com</a>
|
||||
|
|
Loading…
Reference in New Issue
Block a user