aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2018-10-27 12:48:48 +0200
committerKim Alvefur <zash@zash.se>2018-10-27 12:48:48 +0200
commit9bd5cf34cf3a9c9757afbb10b2aeb0534562df01 (patch)
treefef66ebbc8ba36e4f5c8b53cf8953f1ddda40f27
parent193fda720d9de174a5c72d126a97dd6fa8d881fc (diff)
downloadprosody-9bd5cf34cf3a9c9757afbb10b2aeb0534562df01.tar.gz
prosody-9bd5cf34cf3a9c9757afbb10b2aeb0534562df01.zip
util.serialization: Disable use of unquoted table keys by default
For safety against future new keywords
-rw-r--r--util/serialization.lua4
1 files changed, 3 insertions, 1 deletions
diff --git a/util/serialization.lua b/util/serialization.lua
index a8b64c04..52e89136 100644
--- a/util/serialization.lua
+++ b/util/serialization.lua
@@ -85,6 +85,7 @@ local function new(opt)
opt.freeze = true;
opt.fatal = false;
opt.fallback = default_fallback;
+ opt.unquoted = true;
end
if opt.preset == "oneline" then
opt.indentwith = opt.indentwith or "";
@@ -96,6 +97,7 @@ local function new(opt)
opt.itemstart = opt.itemstart or "";
opt.itemlast = opt.itemlast or "";
opt.equals = opt.equals or "=";
+ opt.unquoted = true;
end
local fallback = opt.fallback or opt.fatal == false and default_fallback or fatal_error;
@@ -116,7 +118,7 @@ local function new(opt)
local kstart = opt.kstart or "[";
local kend = opt.kend or "]";
local equals = opt.equals or " = ";
- local unquoted = opt.unquoted == nil and "^[%a_][%w_]*$" or opt.unquoted;
+ local unquoted = opt.unquoted == true and "^[%a_][%w_]*$" or opt.unquoted;
local hex = opt.hex;
local freeze = opt.freeze;
local maxdepth = opt.maxdepth or 127;