From 0ade5d152512bbbbbeddbb39ac3384cfa10fcd4b Mon Sep 17 00:00:00 2001 From: Phillip Davis Date: Thu, 5 Feb 2026 14:35:59 -0500 Subject: [PATCH] apply-hotfix: amend msg fallback logic --- sgx-bwmsgsv2.rb | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/sgx-bwmsgsv2.rb b/sgx-bwmsgsv2.rb index 416629788b98b746fcb1e8f42647017c13b8b33f..2b6dc35adc2d8f95a057ef89e46d333e91d82d75 100755 --- a/sgx-bwmsgsv2.rb +++ b/sgx-bwmsgsv2.rb @@ -1111,8 +1111,16 @@ class WebhookHandler < Goliath::API puts text end - if not msg - msg = Blather::Stanza::Message.new(bare_jid, text) + # If text is not empty, but there isn't a msg, + # we need to construct a msg to convey that text + unless msg || text&.empty? + msg = Blather::Stanza::Message.new( + bare_jid, + # TODO: The numbers, what do they mean? + text.gsub(/[\u0000-\u0008\u000b-\u001f]/, "") + ) + msg.document.encoding = "utf-8" + msg.chat_state = nil end else # per prior switch, this is: jparams['direction'] == 'out' tag_parts = jparams['tag'].split(/ /, 2)