Changeset

4507:86a97e7572b2

mod_pubsub_summary: Fix traceback when <content> not included Noticed while posting entries with only <title> present
author Kim Alvefur <zash@zash.se>
date Fri, 12 Mar 2021 11:00:26 +0100
parents 4506:508cb880b163
children 4508:0329cf8cdecb
files mod_pubsub_summary/mod_pubsub_summary.lua
diffstat 1 files changed, 2 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- 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>");