Mercurial > kallithea
changeset 8509:f950740985f4 stable
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.
author | Mads Kiilerich <mads@kiilerich.com> |
---|---|
date | Mon, 14 Dec 2020 23:18:07 +0100 |
parents | e4d44e4e7716 |
children | 22876c6818d2 |
files | kallithea/templates/changelog/changelog_table.html kallithea/templates/pullrequests/pullrequest_show.html |
diffstat | 2 files changed, 2 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/kallithea/templates/changelog/changelog_table.html Wed Dec 02 21:32:44 2020 +0100 +++ b/kallithea/templates/changelog/changelog_table.html Mon Dec 14 23:18:07 2020 +0100 @@ -55,7 +55,7 @@ <td class="date"> <div data-toggle="tooltip" title="${h.fmt_date(cs.date)}">${h.age(cs.date,True)}</div> </td> - <% message_lines = cs.message.splitlines() %> + <% message_lines = cs.message.strip().splitlines() or [_("(No commit message)")] %> %if len(message_lines) > 1: <td class="expand_commit" title="${_('Expand commit message')}"> <i class="icon-align-left"></i>
--- a/kallithea/templates/pullrequests/pullrequest_show.html Wed Dec 02 21:32:44 2020 +0100 +++ b/kallithea/templates/pullrequests/pullrequest_show.html Mon Dec 14 23:18:07 2020 +0100 @@ -167,7 +167,7 @@ </span> %endfor </div> - <div class="message">${h.urlify_text(cs.message.splitlines()[0], c.repo_name)}</div> + <div class="message">${h.urlify_text(cs.message.strip().split('\n')[0] or _("(No commit message)"), c.repo_name)}</div> </td> %endif </tr>