Bläddra i källkod

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.
master
Дамян Минков 4 år sedan
förälder
incheckning
ba6247daaf
Inget konto är kopplat till bidragsgivarens mejladress

+ 2
- 2
resources/prosody-plugins/mod_polls.lua Visa fil

@@ -22,7 +22,7 @@ local function get_poll_message(stanza)
22 22
 		return nil;
23 23
 	end
24 24
 	local data = json.decode(json_data);
25
-	if data.type ~= "new-poll" and data.type ~= "answer-poll" then
25
+	if not data or (data.type ~= "new-poll" and data.type ~= "answer-poll") then
26 26
 		return nil;
27 27
 	end
28 28
 	return data;
@@ -42,7 +42,7 @@ end
42 42
 module:hook("muc-room-created", function(event)
43 43
 	local room = event.room;
44 44
 	if is_healthcheck_room(room.jid) then return end
45
-	module:log("debug", "setting up polls in room "..tostring(room));
45
+	module:log("debug", "setting up polls in room %s", room.jid);
46 46
 	room.polls = {
47 47
 		by_id = {};
48 48
 		order = {};

+ 3
- 3
resources/prosody-plugins/token/util.lib.lua Visa fil

@@ -128,9 +128,9 @@ function Util:get_public_key(keyId)
128 128
     local content = self.cache:get(keyId);
129 129
     if content == nil then
130 130
         -- If the key is not found in the cache.
131
-        module:log("debug", "Cache miss for key: "..keyId);
131
+        module:log("debug", "Cache miss for key: %s", keyId);
132 132
         local keyurl = path.join(self.asapKeyServer, hex.to(sha256(keyId))..'.pem');
133
-        module:log("debug", "Fetching public key from: "..keyurl);
133
+        module:log("debug", "Fetching public key from: %s", keyurl);
134 134
         content = http_get_with_retry(keyurl, nr_retries);
135 135
         if content ~= nil then
136 136
             self.cache:set(keyId, content);
@@ -138,7 +138,7 @@ function Util:get_public_key(keyId)
138 138
         return content;
139 139
     else
140 140
         -- If the key is in the cache, use it.
141
-        module:log("debug", "Cache hit for key: "..keyId);
141
+        module:log("debug", "Cache hit for key: %s", keyId);
142 142
         return content;
143 143
     end
144 144
 end

Laddar…
Avbryt
Spara