summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrew Lewis <nerf@judo.za.org>2021-01-24 22:55:42 +0200
committerAndrew Lewis <nerf@judo.za.org>2021-01-24 22:55:42 +0200
commitfe3cb3a530925750efc581483b03b48c5e565ab4 (patch)
treeabbf64d4570240f8b41488a495bae6dd7c34dd28
parentb78731fa8a8c4b27e669897df1610db772ed3c84 (diff)
downloadrspamd-fe3cb3a530925750efc581483b03b48c5e565ab4.tar.gz
rspamd-fe3cb3a530925750efc581483b03b48c5e565ab4.zip
[Minor] Update lua-lupa
- Fixed bug where 'else' was not evaluated if 'elseif' is present.
-rw-r--r--contrib/lua-lupa/lupa.lua7
1 files changed, 5 insertions, 2 deletions
diff --git a/contrib/lua-lupa/lupa.lua b/contrib/lua-lupa/lupa.lua
index fc49ac258..adaf419ad 100644
--- a/contrib/lua-lupa/lupa.lua
+++ b/contrib/lua-lupa/lupa.lua
@@ -1,4 +1,4 @@
--- Copyright 2015-2019 Mitchell mitchell.att.foicica.com. See LICENSE.
+-- Copyright 2015-2020 Mitchell. See LICENSE.
-- Sponsored by the Library of the University of Antwerp.
-- Contributions from Ana Balan.
-- Lupa templating engine.
@@ -457,15 +457,18 @@ local function evaluate(ast, env)
if eval(block.expression, env) then
chunks[#chunks + 1] = evaluate(block, env)
else
+ local evaluate_else = true
local elseifs = block['elseif']
if elseifs then
for j = 1, #elseifs do
if eval(elseifs[j].expression, env) then
chunks[#chunks + 1] = evaluate(elseifs[j], env)
+ evaluate_else = false
break
end
end
- elseif block['else'] then
+ end
+ if evaluate_else and block['else'] then
chunks[#chunks + 1] = evaluate(block['else'], env)
end
end