From ba6247daafe90fa5e2eb78916402646646b90624 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=94=D0=B0=D0=BC=D1=8F=D0=BD=20=D0=9C=D0=B8=D0=BD=D0=BA?= =?UTF-8?q?=D0=BE=D0=B2?= Date: Mon, 27 Sep 2021 14:48:13 -0500 Subject: [PATCH] fix: Fixes errors in prosody about string formatting and nil values. (#10037) * fix: Fixes errors in prosody about string formatting and nil values. error Traceback[c2s]: /usr/lib/prosody/util/format.lua:59: invalid option '%b' to 'format' stack traceback: mod_polls.lua:25: attempt to index local 'data' (a nil value) stack traceback: * squash: Fix more formatting concatenation. --- resources/prosody-plugins/mod_polls.lua | 4 ++-- resources/prosody-plugins/token/util.lib.lua | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/resources/prosody-plugins/mod_polls.lua b/resources/prosody-plugins/mod_polls.lua index da58be63a..56d4b5bec 100644 --- a/resources/prosody-plugins/mod_polls.lua +++ b/resources/prosody-plugins/mod_polls.lua @@ -22,7 +22,7 @@ local function get_poll_message(stanza) return nil; end local data = json.decode(json_data); - if data.type ~= "new-poll" and data.type ~= "answer-poll" then + if not data or (data.type ~= "new-poll" and data.type ~= "answer-poll") then return nil; end return data; @@ -42,7 +42,7 @@ end module:hook("muc-room-created", function(event) local room = event.room; if is_healthcheck_room(room.jid) then return end - module:log("debug", "setting up polls in room "..tostring(room)); + module:log("debug", "setting up polls in room %s", room.jid); room.polls = { by_id = {}; order = {}; diff --git a/resources/prosody-plugins/token/util.lib.lua b/resources/prosody-plugins/token/util.lib.lua index a9cc06a15..6f1033c13 100644 --- a/resources/prosody-plugins/token/util.lib.lua +++ b/resources/prosody-plugins/token/util.lib.lua @@ -128,9 +128,9 @@ function Util:get_public_key(keyId) local content = self.cache:get(keyId); if content == nil then -- If the key is not found in the cache. - module:log("debug", "Cache miss for key: "..keyId); + module:log("debug", "Cache miss for key: %s", keyId); local keyurl = path.join(self.asapKeyServer, hex.to(sha256(keyId))..'.pem'); - module:log("debug", "Fetching public key from: "..keyurl); + module:log("debug", "Fetching public key from: %s", keyurl); content = http_get_with_retry(keyurl, nr_retries); if content ~= nil then self.cache:set(keyId, content); @@ -138,7 +138,7 @@ function Util:get_public_key(keyId) return content; else -- If the key is in the cache, use it. - module:log("debug", "Cache hit for key: "..keyId); + module:log("debug", "Cache hit for key: %s", keyId); return content; end end