ztechno_core 0.0.74 → 0.0.75
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/mail_service.js +3 -1
- package/package.json +1 -1
package/lib/mail_service.js
CHANGED
|
@@ -123,7 +123,9 @@ class ZMailService {
|
|
|
123
123
|
* @private
|
|
124
124
|
*/
|
|
125
125
|
async inject(body, inject) {
|
|
126
|
-
|
|
126
|
+
// Sort variable names by length (longest first) to prevent partial matches
|
|
127
|
+
const sortedKeys = Object.keys(inject ?? {}).sort((a, b) => b.length - a.length);
|
|
128
|
+
sortedKeys.forEach((variableName) => {
|
|
127
129
|
const key = `:${variableName}`;
|
|
128
130
|
while (body.indexOf(key) !== -1) {
|
|
129
131
|
body = body.replace(key, inject[variableName].toString());
|