Changeset

4508:0329cf8cdecb

mod_pubsub_eventsource: Fix processing of newlines
author Kim Alvefur <zash@zash.se>
date Fri, 12 Mar 2021 21:32:03 +0100
parents 4507:86a97e7572b2
children 4509:16995e7624f0
files mod_pubsub_eventsource/mod_pubsub_eventsource.lua
diffstat 1 files changed, 1 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mod_pubsub_eventsource/mod_pubsub_eventsource.lua	Fri Mar 12 11:00:26 2021 +0100
+++ b/mod_pubsub_eventsource/mod_pubsub_eventsource.lua	Fri Mar 12 21:32:03 2021 +0100
@@ -49,7 +49,7 @@
 	if (item.name == "json" and item.attr.xmlns == "urn:xmpp:json:0") or (item.name == "data" and item.attr.xmlns == "https://prosody.im/protocol/data") then
 		item = item[1];
 	end
-	local data = "data: "..tostring(item):gsub("\n", "\ndata: \n").."\n\n";
+	local data = "data: "..tostring(item):gsub("\n", "\ndata: ").."\n\n";
 	if not clientlist then module:log("debug", "No clients for %q", node); return; end
 	for response, conn in pairs(clientlist) do
 		conn:write(data);