0
0
Fork 0

Fix being able to post URLs longer than 4096 characters (#17908)

This commit is contained in:
Eugen Rochko 2022-03-30 14:46:03 +02:00 committed by GitHub
parent 5554ff2a1d
commit bbc7afa2a2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 57 additions and 14 deletions

View file

@ -1,6 +1,8 @@
# frozen_string_literal: true
module Extractor
MAX_DOMAIN_LENGTH = 253
extend Twitter::TwitterText::Extractor
module_function
@ -30,6 +32,10 @@ module Extractor
after = $'
unless Twitter::TwitterText::Regex[:end_mention_match].match?(after)
_, domain = screen_name.split('@')
next if domain.present? && domain.length > MAX_DOMAIN_LENGTH
start_position = match_data.char_begin(1) - 1
end_position = match_data.char_end(1)