Hi,

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.

I tracked this down to the changelog_table.html template. It runs message_lines = cs.message.splitlines() and tries to show the first line of the message by rendering message_lines[0]. However, if the commit message is completely empty, message_lines will be too, so trying to access message_lines[0] raises an uncaught IndexError.

Attached is a patch that does the bare minimum to avoid the crash, by forcing message_lines 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.

Hope this helps. If you need any additional information, please let me know.

Thanks,

--
Brett Smith
diff -r 7b7afdbe57af kallithea/templates/changelog/changelog_table.html
--- a/kallithea/templates/changelog/changelog_table.html	Thu Dec 03 01:13:44 2020 +0100
+++ b/kallithea/templates/changelog/changelog_table.html	Mon Dec 14 15:58:03 2020 -0500
@@ -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.splitlines() or [''] %>
         %if len(message_lines) > 1:
         <td class="expand_commit" title="${_('Expand commit message')}">
           <i class="icon-align-left"></i>
_______________________________________________
kallithea-general mailing list
kallithea-general@sfconservancy.org
https://lists.sfconservancy.org/mailman/listinfo/kallithea-general

Reply via email to