mod_spam_report_forwarder: Only forward to xmpp: URIs, and exclude MUCs
authorMatthew Wild <mwild1@gmail.com>
Thu, 29 Feb 2024 16:33:15 +0000
changeset 5851 d00af6ebb326
parent 5850 8b868c00e38e
child 5852 593312fedfe1
mod_spam_report_forwarder: Only forward to xmpp: URIs, and exclude MUCs
mod_spam_report_forwarder/mod_spam_report_forwarder.lua
--- 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