Merge pull request #2936 from MathiusD/expand-link

Increase size of links displayed in video description
This commit is contained in:
Samantaz Fox
2022-04-16 20:31:28 +02:00
committed by GitHub
2 changed files with 15 additions and 3 deletions

View File

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