mod_http_xep227: Fix validation of resulting export XML
authorMatthew Wild <mwild1@gmail.com>
Sat, 15 Jan 2022 14:06:19 +0000
changeset 4872 57311c545013
parent 4871 9d29467f4d5b
child 4873 c3bf568e3977
mod_http_xep227: Fix validation of resulting export XML
mod_http_xep227/mod_http_xep227.lua
--- 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)