From 20a17c9fb7cce57f66628af2c4896a5ba0f5d691 Mon Sep 17 00:00:00 2001 From: rimu <3310831+rimu@users.noreply.github.com> Date: Sun, 19 Jan 2025 15:24:30 +1300 Subject: [PATCH] don't shorten invalid urls --- app/utils.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/utils.py b/app/utils.py index 328d382b..51a50137 100644 --- a/app/utils.py +++ b/app/utils.py @@ -492,7 +492,10 @@ def shorten_string(input_str, max_length=50): def shorten_url(input: str, max_length=20): - return shorten_string(input.replace('https://', '').replace('http://', '')) + if input: + return shorten_string(input.replace('https://', '').replace('http://', '')) + else: + '' # the number of digits in a number. e.g. 1000 would be 4