Update reduce_uri signature
Following request_change at : - https://github.com/iv-org/invidious/pull/2936#discussion_r814436660
This commit is contained in:
parent
78c447829a
commit
0f1bb3fb3b
1 changed files with 3 additions and 6 deletions
|
@ -366,13 +366,10 @@ def fetch_random_instance
|
||||||
return filtered_instance_list.sample(1)[0]
|
return filtered_instance_list.sample(1)[0]
|
||||||
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 !max_length.nil? && str.size > max_length
|
if str.size > max_length
|
||||||
str = str[0, max_length]
|
str = "#{str[0, max_length]}#{suffix}"
|
||||||
if !suffix.nil?
|
|
||||||
str = "#{str}#{suffix}"
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
return str
|
return str
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue