Changeset - f950740985f4
[Not reviewed]
stable
0 2 0
Mads Kiilerich (mads) - 5 years ago 2020-12-14 23:18:07
mads@kiilerich.com
Grafted from: 241c777c21f7
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.
2 files changed with 2 insertions and 2 deletions:
0 comments (0 inline, 0 general)
kallithea/templates/changelog/changelog_table.html
Show inline comments
 
@@ -52,13 +52,13 @@
 
        <td class="hash">
 
          ${h.link_to(h.show_id(cs),h.url('changeset_home',repo_name=repo_name,revision=cs.raw_id), class_='changeset_hash')}
 
        </td>
 
        <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>
 
        </td>
 
        %else:
 
        <td class="expand_commit"></td>
kallithea/templates/pullrequests/pullrequest_show.html
Show inline comments
 
@@ -164,13 +164,13 @@ ${self.repo_context_bar('showpullrequest
 
                            %for tag in cs.tags:
 
                              <span class="label label-tag" title="${_('Tag %s') % tag}">
 
                                ${h.link_to(tag,h.url('changeset_home',repo_name=c.repo_name,revision=cs.raw_id))}
 
                              </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>
 
                  %endfor
 
                </table>
 
              </div>
0 comments (0 inline, 0 general)