From 5c5fd5f26aae16ad89f6c94beae391a2d7072f1b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luk=C3=A1=C5=A1=20Kucharczyk?= Date: Wed, 13 Nov 2024 21:07:26 +0100 Subject: [PATCH] truncate: strip trailing whitespace --- common/utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/utils.py b/common/utils.py index 2f8a437..c687366 100644 --- a/common/utils.py +++ b/common/utils.py @@ -36,7 +36,7 @@ def safe_getattr(obj: object, attr_chain: str, default: Any | None = None) -> ob def truncate(input_string: str, length: int = 30, ellipsis: str = "…") -> str: return ( - (f"{input_string[:length-len(ellipsis)]}{ellipsis}") + (f"{input_string[:length-len(ellipsis)].rstrip()}{ellipsis}") if len(input_string) > length else input_string )