# HG changeset patch # User Kim Alvefur # Date 1526831468 -7200 # Node ID 7878dc2dbf5985f75f9176c33f1953e719e4955a # Parent ded630a8756368a9427e046371ac63a842e02eda mod_pastebin: Avoid using pattern matching facilities for simple prefix removal diff -r ded630a87563 -r 7878dc2dbf59 mod_pastebin/mod_pastebin.lua --- a/mod_pastebin/mod_pastebin.lua Sun May 20 17:49:00 2018 +0200 +++ b/mod_pastebin/mod_pastebin.lua Sun May 20 17:51:08 2018 +0200 @@ -113,8 +113,8 @@ (trigger_string and body:find(trigger_string, 1, true) == 1) or (select(2, body:gsub("\n", "%0")) >= line_threshold) ) then - if trigger_string then - body = body:gsub("^" .. trigger_string, "", 1); + if trigger_string and body:sub(1, #trigger_string) == trigger_string then + body = body:sub(#trigger_string+1); end local url = pastebin_text(body); module:log("debug", "Pasted message as %s", url);