liquid_feedback_frontend

changeset 1841:e6983d79d74f

Fix Lua error on <ol> or <ul> tag at end of input to util.html_is_safe(...)
author jbe
date Thu Feb 03 15:21:45 2022 +0100 (2022-02-03)
parents 5775300b81d6
children 27d2a7609cc1
files env/util/html_is_safe.lua
line diff
     1.1 --- a/env/util/html_is_safe.lua	Wed Apr 28 13:30:18 2021 +0200
     1.2 +++ b/env/util/html_is_safe.lua	Thu Feb 03 15:21:45 2022 +0100
     1.3 @@ -28,12 +28,6 @@
     1.4      -- pre = text before character, tag = text until closing ">", and rest:
     1.5      local pre, tag, rest = string.match(str, "^(.-)([<>][^<>]*>?)(.*)")
     1.6  
     1.7 -    -- Disallow text content (except inter-element white-space) in <ol> or <ul>
     1.8 -    -- when outside <li>:
     1.9 -    if list and string.find(pre, "[^\t\n\f\r ]") then
    1.10 -      return false, "Text content in list but outside list element"
    1.11 -    end
    1.12 -
    1.13      -- If no more "<" or ">" characters are found,
    1.14      -- then return true if all tags have been closed:
    1.15      if not tag then
    1.16 @@ -44,6 +38,12 @@
    1.17        end
    1.18      end
    1.19  
    1.20 +    -- Disallow text content (except inter-element white-space) in <ol> or <ul>
    1.21 +    -- when outside <li>:
    1.22 +    if list and string.find(pre, "[^\t\n\f\r ]") then
    1.23 +      return false, "Text content in list but outside list element"
    1.24 +    end
    1.25 +
    1.26      -- Handle (expected) closing tags:
    1.27      local closed_tagname = string.match(tag, "^</(.-)[\t\n\f\r ]*>$")
    1.28      if closed_tagname then

Impressum / About Us