# HG changeset patch # User Kim Alvefur # Date 1711046667 -3600 # Node ID 8aec430ba20516b9f1901f9e04364372e217c226 # Parent 1c8197075d04d3dc49b86b0c22bc7d2b79c4d94b mod_pastebin: Back out 040eaa3844f4 Triggered error in Lua with if set over 200 and a 200+ line line message is checked. diff -r 1c8197075d04 -r 8aec430ba205 mod_pastebin/mod_pastebin.lua --- a/mod_pastebin/mod_pastebin.lua Sun Mar 17 15:05:29 2024 +0100 +++ b/mod_pastebin/mod_pastebin.lua Thu Mar 21 19:44:27 2024 +0100 @@ -100,8 +100,6 @@ end end -local line_count_pattern = string.rep("[^\n]*\n", line_threshold + 1):sub(1,-2); - function check_message(data) local stanza = data.stanza; @@ -122,7 +120,8 @@ if ( #body > length_threshold and utf8_length(body) > length_threshold ) or (trigger_string and body:find(trigger_string, 1, true) == 1) or - body:find(line_count_pattern) then + (select(2, body:gsub("\n", "%0")) >= line_threshold) + then if trigger_string and body:sub(1, #trigger_string) == trigger_string then body = body:sub(#trigger_string+1); end