comparison mod_pastebin/mod_pastebin.lua @ 3099:c88f91626e07

mod_pastebin: Off-by-one, the hardest problem known to man The threshold set to 4 allowed 4 lines and pastebinned 5. 040eaa3844f4 unintentionally changed this so that 4 lines were pastebinned. This commit restores the previous behavior.
author Kim Alvefur <zash@zash.se>
date Sun, 03 Jun 2018 14:09:30 +0200
parents 26977c4760f5
children 03cda95ae97a
comparison
equal deleted inserted replaced
3098:a81456a13797 3099:c88f91626e07
93 if not once then 93 if not once then
94 s:add_child(replacement); 94 s:add_child(replacement);
95 end 95 end
96 end 96 end
97 97
98 local line_count_pattern = string.rep("[^\n]*\n", line_threshold):sub(1, -2); 98 local line_count_pattern = string.rep("[^\n]*\n", line_threshold + 1):sub(1,-2);
99 99
100 function check_message(data) 100 function check_message(data)
101 local stanza = data.stanza; 101 local stanza = data.stanza;
102 102
103 -- Only check for MUC presence when loaded on a component. 103 -- Only check for MUC presence when loaded on a component.