<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<div class="moz-cite-prefix">Ouch, yeah, .splitlines() is
confusingly different from .split('\n') . Thanks for the patch.</div>
<div class="moz-cite-prefix"><br>
</div>
<div class="moz-cite-prefix">Would it perhaps be better to just use
.split instead of .splitlines()?<br>
</div>
<div class="moz-cite-prefix"><br>
</div>
<div class="moz-cite-prefix">But since the commit message text is
shown as a link, would it perhaps be even better to avoid the void
and show a text like "(No commit message)"?</div>
<div class="moz-cite-prefix"><br>
</div>
<div class="moz-cite-prefix">And if it is possible to have an empty
commit message, should we perhaps also have nice handling of the
case where the first line is empty?</div>
<div class="moz-cite-prefix"><br>
</div>
<div class="moz-cite-prefix">So something like</div>
<div class="moz-cite-prefix"><br>
</div>
<div class="moz-cite-prefix">---
kallithea/templates/changelog/changelog_table.html<br>
+++ kallithea/templates/changelog/changelog_table.html<br>
@@ -55,7 +55,7 @@<br>
<td class="date"><br>
<div data-toggle="tooltip"
title="${h.fmt_date(cs.date)}">${h.age(cs.date,True)}</div><br>
</td><br>
- <% message_lines = cs.message.splitlines() %><br>
+ <% message_lines = cs.message.strip().splitlines() or
[_("(No commit message)")] %><br>
%if len(message_lines) > 1:<br>
<td class="expand_commit" title="${_('Expand commit
message')}"><br>
<i class="icon-align-left"></i><br>
</div>
<div class="moz-cite-prefix"><br>
</div>
<div class="moz-cite-prefix">Also, I can see we also have the same
problem in pullrequest_show.html ...<br>
</div>
<div class="moz-cite-prefix"><br>
</div>
<div class="moz-cite-prefix">/Mads</div>
<div class="moz-cite-prefix"><br>
</div>
<div class="moz-cite-prefix"><br>
</div>
<div class="moz-cite-prefix">On 12/14/20 10:04 PM, Brett Smith
wrote:<br>
</div>
<blockquote type="cite"
cite="mid:2bb720c9-0fcd-6992-af16-a702d834951a@sfconservancy.org">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<p>Hi,</p>
<p>I recently upgraded a Kallithea server to 0.6.3, and I was
running into an issue where trying to view the landing page for
one specific repository, but not others, was crashing.</p>
<p>I tracked this down to the changelog_table.html template. It
runs <tt>message_lines = cs.message.splitlines()</tt> and tries
to show the first line of the message by rendering <tt>message_lines[0]</tt>.
However, if the commit message is completely empty, <tt>message_lines</tt>
will be too, so trying to access <tt>message_lines[0]</tt>
raises an uncaught IndexError.</p>
<p>Attached is a patch that does the bare minimum to avoid the
crash, by forcing <tt>message_lines</tt> to contain an empty
string in this case. It might be nice to do something nicer like
render a dedicated, localized message in this case. But
hopefully this helps identify the issue.</p>
<p>Hope this helps. If you need any additional information, please
let me know.</p>
<p>Thanks,<br>
</p>
<div class="moz-signature">-- <br>
Brett Smith</div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<pre class="moz-quote-pre" wrap="">_______________________________________________
kallithea-general mailing list
<a class="moz-txt-link-abbreviated" href="mailto:kallithea-general@sfconservancy.org">kallithea-general@sfconservancy.org</a>
<a class="moz-txt-link-freetext" href="https://lists.sfconservancy.org/mailman/listinfo/kallithea-general">https://lists.sfconservancy.org/mailman/listinfo/kallithea-general</a>
</pre>
</blockquote>
<p><br>
</p>
</body>
</html>