Software /
code /
prosody-modules
Changeset
5302:ba94a5301985
mod_cloud_notify_filters: Fix traceback when invalid JIDs are submitted
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Tue, 04 Apr 2023 18:09:48 +0100 |
parents | 5301:8ef197cccd74 |
children | 5303:b10a7082b3c3 |
files | mod_cloud_notify_filters/mod_cloud_notify_filters.lua |
diffstat | 1 files changed, 15 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/mod_cloud_notify_filters/mod_cloud_notify_filters.lua Sat Apr 01 13:56:53 2023 +0100 +++ b/mod_cloud_notify_filters/mod_cloud_notify_filters.lua Tue Apr 04 18:09:48 2023 +0100 @@ -28,7 +28,12 @@ if filter_muted then local muted_jids = {}; for item in filter_muted:childtags("item") do - muted_jids[jid.prep(item.attr.jid)] = true; + local room_jid = jid.prep(item.attr.jid); + if not room_jid then + module:log("warn", "Skipping invalid JID: <%s>", room_jid); + else + muted_jids[room_jid] = true; + end end event.push_info.muted_jids = muted_jids; end @@ -37,10 +42,15 @@ if filter_groupchat then local groupchat_rules = {}; for item in filter_groupchat:childtags("room") do - groupchat_rules[jid.prep(item.attr.jid)] = { - when = item.attr.allow; - nick = item.attr.nick; - }; + local room_jid = jid.prep(item.attr.jid); + if not room_jid then + module:log("warn", "Skipping invalid JID: <%s>", item.attr.jid); + else + groupchat_rules[room_jid] = { + when = item.attr.allow; + nick = item.attr.nick; + }; + end end event.push_info.groupchat_rules = groupchat_rules; end