# HG changeset patch # User Mads Kiilerich # Date 2020-12-14 23:18:07 # Node ID f950740985f47ea09ef3361fa56b3d7581429156 # Parent e4d44e4e771617317b8e475b35c7536fc3640af7 changelog: fix crash on display of empty commit messages Also handle commit messages with leading whitespace. .splitlines() is different from .split('\n') and will give an empty list when given an empty string. Problem reported and initial patch proposed by Brett Smith. diff --git a/kallithea/templates/changelog/changelog_table.html b/kallithea/templates/changelog/changelog_table.html --- a/kallithea/templates/changelog/changelog_table.html +++ b/kallithea/templates/changelog/changelog_table.html @@ -55,7 +55,7 @@
${h.age(cs.date,True)}
- <% message_lines = cs.message.splitlines() %> + <% message_lines = cs.message.strip().splitlines() or [_("(No commit message)")] %> %if len(message_lines) > 1: diff --git a/kallithea/templates/pullrequests/pullrequest_show.html b/kallithea/templates/pullrequests/pullrequest_show.html --- a/kallithea/templates/pullrequests/pullrequest_show.html +++ b/kallithea/templates/pullrequests/pullrequest_show.html @@ -167,7 +167,7 @@ ${self.repo_context_bar('showpullrequest %endfor -
${h.urlify_text(cs.message.splitlines()[0], c.repo_name)}
+
${h.urlify_text(cs.message.strip().split('\n')[0] or _("(No commit message)"), c.repo_name)}
%endif