Software /
code /
prosody
Comparison
plugins/mod_admin_shell.lua @ 12505:604bb5b8362d 0.12
mod_admin_shell: Tighten up type checks to fix #1754 (thanks clouded)
Due to the dummy statistics provider (see core.statsmanager line 250)
having a metatable that allows infinite indexing where everything is
always the same table, which end up in suf() in the concatenation line.
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Sun, 15 May 2022 23:16:14 +0200 |
parent | 12304:8210c2a52e9c |
child | 12506:d04f6f014636 |
child | 12637:2200f0c6b3f1 |
comparison
equal
deleted
inserted
replaced
12500:88e1b94105ae | 12505:604bb5b8362d |
---|---|
47 if not s then return end | 47 if not s then return end |
48 return (s:gsub("^%a", string.upper):gsub("_", " ")); | 48 return (s:gsub("^%a", string.upper):gsub("_", " ")); |
49 end | 49 end |
50 | 50 |
51 local function pre(prefix, str, alt) | 51 local function pre(prefix, str, alt) |
52 if (str or "") == "" then return alt or ""; end | 52 if type(str) ~= "string" or str == "" then return alt or ""; end |
53 return prefix .. str; | 53 return prefix .. str; |
54 end | 54 end |
55 | 55 |
56 local function suf(str, suffix, alt) | 56 local function suf(str, suffix, alt) |
57 if (str or "") == "" then return alt or ""; end | 57 if type(str) ~= "string" or str == "" then return alt or ""; end |
58 return str .. suffix; | 58 return str .. suffix; |
59 end | 59 end |
60 | 60 |
61 local commands = module:shared("commands") | 61 local commands = module:shared("commands") |
62 local def_env = module:shared("env"); | 62 local def_env = module:shared("env"); |