Mercurial > prosody-hg
view util/adhoc.lua @ 14178:af87d31dcae4 13.0
util.crypto: Ensure signing parameter is a string
lua_tostring() returns NULL if the specified value is missing or can't become
a string. luaL_checkstring() will raise an error.
We prefer the latter behaviour, otherwise we end up passing NULL to OpenSSL.
| author | Matthew Wild <mwild1@gmail.com> |
|---|---|
| date | Mon, 25 May 2026 14:51:15 +0100 |
| parents | e10567199f02 |
| children |
line wrap: on
line source
-- luacheck: ignore 212/self local function new_simple_form(form, result_handler) return function(self, data, state) if state or data.form then if data.action == "cancel" then return { status = "canceled" }; end local fields, err = form:data(data.form); return result_handler(fields, err, data); else return { status = "executing", actions = {"next", "complete", default = "complete"}, form = form }, "executing"; end end end local function new_initial_data_form(form, initial_data, result_handler) return function(self, data, state) if state or data.form then if data.action == "cancel" then return { status = "canceled" }; end local fields, err = form:data(data.form); return result_handler(fields, err, data); else local values, err = initial_data(data); if type(err) == "table" then return {status = "error"; error = err} elseif type(err) == "string" then return {status = "error"; error = {type = "cancel"; condition = "internal-server-error", err}} end return { status = "executing", actions = {"next", "complete", default = "complete"}, form = { layout = form, values = values } }, "executing"; end end end return { new_simple_form = new_simple_form, new_initial_data_form = new_initial_data_form };
