# HG changeset patch
# User jbe
# Date 1643898105 -3600
# Node ID e6983d79d74f11ef509e8f79b0aafcb0ed87e2e3
# Parent 5775300b81d60887016fd428373ea018f6f02bcb
Fix Lua error on
or tag at end of input to util.html_is_safe(...)
diff -r 5775300b81d6 -r e6983d79d74f env/util/html_is_safe.lua
--- a/env/util/html_is_safe.lua Wed Apr 28 13:30:18 2021 +0200
+++ b/env/util/html_is_safe.lua Thu Feb 03 15:21:45 2022 +0100
@@ -28,12 +28,6 @@
-- pre = text before character, tag = text until closing ">", and rest:
local pre, tag, rest = string.match(str, "^(.-)([<>][^<>]*>?)(.*)")
- -- Disallow text content (except inter-element white-space) in or
- -- when outside - :
- if list and string.find(pre, "[^\t\n\f\r ]") then
- return false, "Text content in list but outside list element"
- end
-
-- If no more "<" or ">" characters are found,
-- then return true if all tags have been closed:
if not tag then
@@ -44,6 +38,12 @@
end
end
+ -- Disallow text content (except inter-element white-space) in
or
+ -- when outside - :
+ if list and string.find(pre, "[^\t\n\f\r ]") then
+ return false, "Text content in list but outside list element"
+ end
+
-- Handle (expected) closing tags:
local closed_tagname = string.match(tag, "^(.-)[\t\n\f\r ]*>$")
if closed_tagname then