Diff

mod_http_xep227/mod_http_xep227.lua @ 4868:57311c545013

mod_http_xep227: Fix validation of resulting export XML
author Matthew Wild <mwild1@gmail.com>
date Sat, 15 Jan 2022 14:06:19 +0000
parent 4867:9d29467f4d5b
child 4869:c3bf568e3977
line wrap: on
line diff
--- a/mod_http_xep227/mod_http_xep227.lua	Sat Jan 15 13:46:34 2022 +0000
+++ b/mod_http_xep227/mod_http_xep227.lua	Sat Jan 15 14:06:19 2022 +0000
@@ -132,13 +132,15 @@
 		end
 	end
 
-	if not user_xml or not user_xml:find("host/user") then
-		module:log("warn", "No data to export: %s", tostring(user_xml));
+	local xml_data = user_xml:get_user_xml(username, session.host);
+
+	if not xml_data or not xml_data:find("host/user") then
+		module:log("warn", "No data to export: %s", tostring(xml_data));
 		return 204;
 	end
 
 	event.response.headers["Content-Type"] = "application/xml";
-	return [[<?xml version="1.0" encoding="utf-8" ?>]]..tostring(user_xml);
+	return [[<?xml version="1.0" encoding="utf-8" ?>]]..tostring(xml_data);
 end
 
 local function is_looking_like_xep227(xml_data)