fix: trace was passed in the request method shortened url for trace
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful

This commit is contained in:
2024-04-26 13:03:20 +02:00
parent 7bc73de128
commit e2b7c5475f
3 changed files with 10 additions and 2 deletions

View File

@@ -178,3 +178,9 @@ def match_length(length_1: int | None, length_2: int | None) -> bool:
if length_1 is None or length_2 is None:
return True
return abs(length_1 - length_2) <= ALLOWED_LENGTH_DISTANCE
def shorten_display_url(url: str, max_length: int = 150, chars_at_end: int = 4, shorten_string: str = "[...]") -> str:
if len(url) <= max_length + chars_at_end + len(shorten_string):
return url
return url[:max_length] + shorten_string + url[-chars_at_end:]