From e5de270e6559bc8bfc3aff2922ef1a81c6c79bda Mon Sep 17 00:00:00 2001 From: rubenwardy Date: Sat, 27 Jul 2024 22:10:04 +0100 Subject: [PATCH] Fix short_description being cut when not needed --- app/tasks/minetestcheck/tree.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/app/tasks/minetestcheck/tree.py b/app/tasks/minetestcheck/tree.py index 3cb20952..a873e65e 100644 --- a/app/tasks/minetestcheck/tree.py +++ b/app/tasks/minetestcheck/tree.py @@ -235,9 +235,12 @@ class PackageTreeNode: # Calculate short description if "description" in result: desc = result["description"] - idx = desc.find(".") + 1 - cutIdx = min(len(desc), 200 if idx < 5 else idx) - result["short_description"] = desc[:cutIdx] + if len(desc) > 200: + idx = desc.find(".") + 1 + idx = min(len(desc), 200 if idx < 5 else idx) + result["short_description"] = desc[:idx] + else: + result["short_description"] = desc if "name" in result: self.name = result["name"]