Skip to content

Commit 0f1bb3f

Browse files
committed
Update reduce_uri signature
Following request_change at : - #2936 (comment)
1 parent 78c4478 commit 0f1bb3f

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

src/invidious/helpers/utils.cr

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -366,13 +366,10 @@ def fetch_random_instance
366366
return filtered_instance_list.sample(1)[0]
367367
end
368368

369-
def reduce_uri(uri : URI | String, max_length : Int32? = 50, suffix : String? = "...") : String
369+
def reduce_uri(uri : URI | String, max_length : Int32 = 50, suffix : String = "") : String
370370
str = uri.to_s.sub(/https?:\/\//, "")
371-
if !max_length.nil? && str.size > max_length
372-
str = str[0, max_length]
373-
if !suffix.nil?
374-
str = "#{str}#{suffix}"
375-
end
371+
if str.size > max_length
372+
str = "#{str[0, max_length]}#{suffix}"
376373
end
377374
return str
378375
end

0 commit comments

Comments
 (0)