changeset 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
parents 9d29467f4d5b
children c3bf568e3977
files mod_http_xep227/mod_http_xep227.lua
diffstat 1 files changed, 5 insertions(+), 3 deletions(-) [+]
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)