changeset 5847:d00af6ebb326

mod_spam_report_forwarder: Only forward to xmpp: URIs, and exclude MUCs
author Matthew Wild <mwild1@gmail.com>
date Thu, 29 Feb 2024 16:33:15 +0000
parents 8b868c00e38e
children 593312fedfe1
files mod_spam_report_forwarder/mod_spam_report_forwarder.lua
diffstat 1 files changed, 4 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mod_spam_report_forwarder/mod_spam_report_forwarder.lua	Sun Feb 25 19:17:40 2024 -0500
+++ b/mod_spam_report_forwarder/mod_spam_report_forwarder.lua	Thu Feb 29 16:33:15 2024 +0000
@@ -39,7 +39,10 @@
 		local field_var = select(i, ...);
 		local field = form:get_child_with_attr("field", "jabber:x:data", "var", field_var);
 		if field then
-			return url.parse(field:get_child_text("value")).path;
+			local parsed = url.parse(field:get_child_text("value"));
+			if parsed.scheme == "xmpp" and parsed.path and not parsed.query then
+				return parsed.path;
+			end
 		end
 	end
 end