mirror of
https://github.com/discourse/discourse.git
synced 2025-03-21 16:35:32 +08:00
Fix broken spec.
Follow-up to 3c678df942b9322bfda5eb47d428b1c692ac0bf4
This commit is contained in:
parent
cabbc32024
commit
2607bb602e
@ -89,15 +89,16 @@ class Search
|
||||
end
|
||||
|
||||
data.gsub!(/\S+/) do |str|
|
||||
if str.match?(/^(https?:\/\/)[\S]+$/)
|
||||
if str =~ /^["]?((https?:\/\/)[\S]+)["]?$/
|
||||
begin
|
||||
uri = URI.parse(str)
|
||||
uri = URI.parse(Regexp.last_match[1])
|
||||
uri.query = nil
|
||||
str = uri.to_s
|
||||
rescue URI::Error
|
||||
# don't fail if uri does not parse
|
||||
end
|
||||
end
|
||||
|
||||
str
|
||||
end
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user