mirror of
https://github.com/discourse/discourse.git
synced 2025-04-01 08:55:56 +08:00
minor style fix
This commit is contained in:
parent
5267e5bea6
commit
d54f6faa35
@ -236,12 +236,12 @@ module PrettyText
|
|||||||
def self.make_all_links_absolute(html)
|
def self.make_all_links_absolute(html)
|
||||||
site_uri = nil
|
site_uri = nil
|
||||||
doc = Nokogiri::HTML.fragment(html)
|
doc = Nokogiri::HTML.fragment(html)
|
||||||
doc.css("a").each do |l|
|
doc.css("a").each do |link|
|
||||||
href = l["href"].to_s
|
href = link["href"].to_s
|
||||||
begin
|
begin
|
||||||
uri = URI(href)
|
uri = URI(href)
|
||||||
site_uri ||= URI(Discourse.base_url)
|
site_uri ||= URI(Discourse.base_url)
|
||||||
l["href"] = "#{site_uri}#{l['href']}" unless uri.host.present?
|
link["href"] = "#{site_uri}#{link['href']}" unless uri.host.present?
|
||||||
rescue URI::InvalidURIError
|
rescue URI::InvalidURIError
|
||||||
# leave it
|
# leave it
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user