FIX: remove deprecated URI.escape (#9697)

During Nokogumbo changes I introduced back URI.escape which is deprecated.
This commit is contained in:
Krzysztof Kotlarek 2020-05-08 11:14:59 +10:00 committed by GitHub
parent 22dffe6f69
commit a3e1e9ef16
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 5 deletions

View File

@ -158,7 +158,7 @@ module Jobs
doc.css("a.mention").each do |a|
a.content = a.content.gsub(@cooked_mention_username_regex, "@#{@new_username}")
a["href"] = a["href"].gsub(@cooked_mention_user_path_regex, "/u/#{URI.escape(@new_username)}") if a["href"]
a["href"] = a["href"].gsub(@cooked_mention_user_path_regex, "/u/#{UrlHelper.encode_component(@new_username)}") if a["href"]
end
doc.css("aside.quote").each do |aside|

View File

@ -286,7 +286,7 @@ module PrettyText
doc.css("a").each do |l|
href = l["href"].to_s
begin
uri = URI(URI.escape(href))
uri = URI(UrlHelper.encode_component(href))
site_uri ||= URI(Discourse.base_url)
if !uri.host.present? ||
@ -466,13 +466,13 @@ module PrettyText
case type
when USER_TYPE
element['href'] = "#{Discourse::base_uri}/u/#{URI.escape(name)}"
element['href'] = "#{Discourse::base_uri}/u/#{UrlHelper.encode_component(name)}"
when GROUP_MENTIONABLE_TYPE
element['class'] = 'mention-group notify'
element['href'] = "#{Discourse::base_uri}/groups/#{URI.escape(name)}"
element['href'] = "#{Discourse::base_uri}/groups/#{UrlHelper.encode_component(name)}"
when GROUP_TYPE
element['class'] = 'mention-group'
element['href'] = "#{Discourse::base_uri}/groups/#{URI.escape(name)}"
element['href'] = "#{Discourse::base_uri}/groups/#{UrlHelper.encode_component(name)}"
end
end
end