Fix short_description being cut when not needed

This commit is contained in:
rubenwardy 2024-07-27 22:10:04 +01:00
parent 031c3c4684
commit e5de270e65

@ -235,9 +235,12 @@ class PackageTreeNode:
# Calculate short description # Calculate short description
if "description" in result: if "description" in result:
desc = result["description"] desc = result["description"]
idx = desc.find(".") + 1 if len(desc) > 200:
cutIdx = min(len(desc), 200 if idx < 5 else idx) idx = desc.find(".") + 1
result["short_description"] = desc[:cutIdx] idx = min(len(desc), 200 if idx < 5 else idx)
result["short_description"] = desc[:idx]
else:
result["short_description"] = desc
if "name" in result: if "name" in result:
self.name = result["name"] self.name = result["name"]