# HG changeset patch # User Kim Alvefur # Date 1615543226 -3600 # Node ID 86a97e7572b28656b14d6e1b7fbf2f8f23dd2458 # Parent 508cb880b1630d66cbcd8c4cb0bf42da677831ba mod_pubsub_summary: Fix traceback when not included Noticed while posting entries with only present diff -r 508cb880b163 -r 86a97e7572b2 mod_pubsub_summary/mod_pubsub_summary.lua --- a/mod_pubsub_summary/mod_pubsub_summary.lua Tue Mar 09 18:44:35 2021 +0100 +++ b/mod_pubsub_summary/mod_pubsub_summary.lua Fri Mar 12 11:00:26 2021 +0100 @@ -7,8 +7,8 @@ -- Note: This prefers content over summary, it was made for a news feed where -- the interesting stuff was in the content and the summary was .. meh. local content_tag = payload:get_child("content") or payload:get_child("summary"); - local content = content_tag:get_text(); - if content_tag.attr.type == "html" then + local content = content_tag and content_tag:get_text(); + if content and content_tag.attr.type == "html" then content = content:gsub("\n*<p[^>]*>\n*(.-)\n*</p>\n*", "%1\n\n"); content = content:gsub("<li>(.-)</li>\n", "* %1\n"); content = content:gsub("<a[^>]*href=[\"'](.-)[\"'][^>]*>(.-)</a>", "%2 <%1>");