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
 
@@ -46,25 +46,25 @@
 
          %endif
 
        </td>
 
        <td class="author" data-toggle="tooltip" title="${cs.author}">
 
          ${h.gravatar(h.email_or_none(cs.author), size=16)}
 
          <span class="user">${h.person(cs.author)}</span>
 
        </td>
 
        <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>
 
        %endif
 
        <td class="mid">
 
          <div class="log-container">
 
            <div class="message">
 
              <div class="message-firstline">${h.urlify_text(message_lines[0], c.repo_name,h.url('changeset_home',repo_name=repo_name,revision=cs.raw_id))}</div>
 
              %if len(message_lines) > 1:
kallithea/templates/pullrequests/pullrequest_show.html
Show inline comments
 
@@ -158,25 +158,25 @@ ${self.repo_context_bar('showpullrequest
 
                        </td>
 
                        %endif
 
                        <td><span data-toggle="tooltip" title="${h.age(cs.date)}">${cs.date}</span></td>
 
                        <td>${h.link_to(h.show_id(cs),h.url('changeset_home',repo_name=c.cs_repo.repo_name,revision=cs.raw_id), class_='changeset_hash')}</td>
 
                        <td>
 
                          <div class="pull-right">
 
                            %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>
 
              <div class="alert alert-info">${_("Pull request iterations do not change content once created. Select a revision to create a new iteration.")}</div>
 
              %endif
 
              %if c.update_msg_other:
 
                <div class="alert alert-info">${c.update_msg_other}</div>
 
              %endif
 
            </div>
0 comments (0 inline, 0 general)