From 0edce2af4ea9b0e4bd631b9400d605465f158054 Mon Sep 17 00:00:00 2001 From: "Rob Swindell (on Debian Linux)" <rob@synchro.net> Date: Tue, 28 Feb 2023 13:25:41 -0800 Subject: [PATCH] Fix @-code replacment logic in newuser.msg Fix 2 issues with commit df799b0a: 1. Need to replace @-code globally, otherwise only the first @-code was replaced 2. Need to strip the leading and trailing @'s from the code before passing to bbs.atcode() - fix for issue #527 --- exec/newuser.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exec/newuser.js b/exec/newuser.js index a9e053ce65..bfb633c24f 100644 --- a/exec/newuser.js +++ b/exec/newuser.js @@ -142,7 +142,7 @@ function send_newuser_welcome_msg(fname) subject: "Welcome to " + system.name + "!" }; - msgtxt = msgtxt.replace(/@(\w+)@/, function (code) { return bbs.atcode(code); }); + msgtxt = msgtxt.replace(/@(\w+)@/g, function (code) { return bbs.atcode(code.slice(1, -1)); }); var result = msgbase.save_msg(hdr, msgtxt); if(!result) log(LOG_ERR, "!ERROR " + msgbase.error + " saving mail message"); -- GitLab