mod_server_contact_info: Generate properly escaped URIs from 'admins'

This commit is contained in:
Kim Alvefur 2020-09-11 18:34:36 +02:00
parent a87492d53c
commit 59cae27ea2

View file

@ -8,6 +8,7 @@
local array = require "util.array";
local jid = require "util.jid";
local url = require "socket.url";
-- Source: http://xmpp.org/registrar/formtypes.html#http:--jabber.org-network-serverinfo
local form_layout = require "util.dataforms".new({
@ -25,7 +26,7 @@ local form_layout = require "util.dataforms".new({
local admins = module:get_option_inherited_set("admins", {});
local contact_config = module:get_option("contact_info", {
admin = array.collect( admins / jid.prep / function(admin) return "xmpp:" .. admin; end);
admin = array.collect(admins / jid.prep / function(admin) return url.build({scheme = "xmpp"; path = admin}); end);
});
module:add_extension(form_layout:form(contact_config, "result"));