diff --git a/operator-pipeline-images/operatorcert/entrypoints/publish.py b/operator-pipeline-images/operatorcert/entrypoints/publish.py index cfb4284c2..e8eb0fe69 100644 --- a/operator-pipeline-images/operatorcert/entrypoints/publish.py +++ b/operator-pipeline-images/operatorcert/entrypoints/publish.py @@ -151,7 +151,7 @@ def create_repository(args: Any, project: Dict[str, Any]) -> Any: long_description = container.get("repository_description") or " " # strip html, trim by word boundary, max length 100, add ellipsis short_description = html2text.html2text(long_description) - short_description = textwrap.wrap(short_description, 97)[0] + "..." + short_description = textwrap.shorten(short_description, 97, placeholder="...") display_data = { "name": project.get("name", ""), diff --git a/operator-pipeline-images/tests/entrypoints/test_publish.py b/operator-pipeline-images/tests/entrypoints/test_publish.py index 4c0aa4720..564e9a73d 100644 --- a/operator-pipeline-images/tests/entrypoints/test_publish.py +++ b/operator-pipeline-images/tests/entrypoints/test_publish.py @@ -89,7 +89,7 @@ def test_create_repository(mock_get_vendor: MagicMock, mock_post: MagicMock) -> "container": { "distribution_method": "rhcc", "repository_name": "repo_name", - "repository_description": "descrip", + "repository_description": "very long description " * 10, "release_category": "rel_cat", "privileged": True, "application_categories": "app_cat", @@ -109,8 +109,9 @@ def test_create_repository(mock_get_vendor: MagicMock, mock_post: MagicMock) -> "release_categories": ["rel_cat"], "display_data": { "name": "project_name", - "long_description": "descrip", - "short_description": "descrip...", + "long_description": "very long description " * 10, + "short_description": "very long description very long description " + "very long description very long description very...", }, "non_production_only": False, "privileged_images_allowed": True,