mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
FIX: URLs containing two # would fail to work
Some URLs in browsers are non compliant and contain twos `#` this commit adds special handling for this edge case by auto encoding any fragments containing `#`
This commit is contained in:
@@ -117,11 +117,7 @@ SQL
|
||||
PrettyText
|
||||
.extract_links(post.cooked)
|
||||
.map do |u|
|
||||
uri = begin
|
||||
URI.parse(u.url)
|
||||
rescue URI::Error
|
||||
end
|
||||
|
||||
uri = UrlHelper.relaxed_parse(u.url)
|
||||
[u, uri]
|
||||
end
|
||||
.reject { |_, p| p.nil? || "mailto".freeze == p.scheme }
|
||||
|
||||
@@ -15,11 +15,7 @@ class TopicLinkClick < ActiveRecord::Base
|
||||
url = args[:url][0...TopicLink.max_url_length]
|
||||
return nil if url.blank?
|
||||
|
||||
uri = begin
|
||||
URI.parse(url)
|
||||
rescue URI::Error
|
||||
end
|
||||
|
||||
uri = UrlHelper.relaxed_parse(url)
|
||||
urls = Set.new
|
||||
urls << url
|
||||
if url =~ /^http/
|
||||
|
||||
Reference in New Issue
Block a user