From e1fcad34a9e3c3fd22b3bee66b82d85bd03629fb Mon Sep 17 00:00:00 2001 From: Eugen Rochko Date: Mon, 31 Jul 2017 05:06:20 +0200 Subject: Fix length validator counting things that look like URIs like URLs (#4462) URI.extract is too strong, not limited to URLs, matched real text. Same issue was present in language detector. --- app/lib/language_detector.rb | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'app/lib') diff --git a/app/lib/language_detector.rb b/app/lib/language_detector.rb index 6d6ae2fb3..cc7509fdc 100644 --- a/app/lib/language_detector.rb +++ b/app/lib/language_detector.rb @@ -33,9 +33,7 @@ class LanguageDetector def simplified_text text.dup.tap do |new_text| - URI.extract(new_text).each do |url| - new_text.gsub!(url, '') - end + new_text.gsub!(FetchLinkCardService::URL_PATTERN, '') new_text.gsub!(Account::MENTION_RE, '') new_text.gsub!(Tag::HASHTAG_RE, '') new_text.gsub!(/\s+/, ' ') -- cgit