Fix broken spec.

Follow-up to 3c678df942
This commit is contained in:
Guo Xiang Tan 2020-10-08 09:14:12 +08:00 committed by Alan Guo Xiang Tan
parent cabbc32024
commit 2607bb602e
1 changed files with 3 additions and 2 deletions

View File

@ -89,15 +89,16 @@ class Search
end end
data.gsub!(/\S+/) do |str| data.gsub!(/\S+/) do |str|
if str.match?(/^(https?:\/\/)[\S]+$/) if str =~ /^["]?((https?:\/\/)[\S]+)["]?$/
begin begin
uri = URI.parse(str) uri = URI.parse(Regexp.last_match[1])
uri.query = nil uri.query = nil
str = uri.to_s str = uri.to_s
rescue URI::Error rescue URI::Error
# don't fail if uri does not parse # don't fail if uri does not parse
end end
end end
str str
end end