Update regex reduce_uri utils

Follow this comment :
https://github.com/iv-org/invidious/pull/2936#discussion_r850712676
pull/2936/head
Féry Mathieu (Mathius) 2 years ago
parent 68ac18dc98
commit 6c122248f5
No known key found for this signature in database
GPG Key ID: F9CCC80C18A59037

@ -367,7 +367,7 @@ def fetch_random_instance
end end
def reduce_uri(uri : URI | String, max_length : Int32 = 50, suffix : String = "") : String def reduce_uri(uri : URI | String, max_length : Int32 = 50, suffix : String = "") : String
str = uri.to_s.sub(/https?:\/\//, "") str = uri.to_s.sub(/^https?:\/\//, "")
if str.size > max_length if str.size > max_length
str = "#{str[0, max_length]}#{suffix}" str = "#{str[0, max_length]}#{suffix}"
end end

Loading…
Cancel
Save