Software /
code /
prosody-modules
Changeset
5896:8aec430ba205
mod_pastebin: Back out 040eaa3844f4
Triggered error in Lua with if set over 200 and a 200+ line line message
is checked.
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Thu, 21 Mar 2024 19:44:27 +0100 |
parents | 5895:1c8197075d04 |
children | 5897:a88c43de648c |
files | mod_pastebin/mod_pastebin.lua |
diffstat | 1 files changed, 2 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- 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