From 86152e3f9957a9e2146f21c7b92b9ba2514d43e4 Mon Sep 17 00:00:00 2001 From: Girish Ramakrishnan Date: Fri, 24 Jun 2016 12:38:26 -0500 Subject: [PATCH] escape the email --- common.js | 7 ++++++- test/cloudron-backup-test.js | 4 ++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/common.js b/common.js index 324b55f..f581051 100644 --- a/common.js +++ b/common.js @@ -17,11 +17,16 @@ exports = module.exports = { getOwner: getOwner, getAdmin: getAdmin, stripeSecret: stripeSecret, - stripUnreachable: stripUnreachable + stripUnreachable: stripUnreachable, + regexp: regexp }; var gEcosystem = safe.require(path.join(__dirname, '../secrets/e2e-test/ecosystem-staging.json')); +function regexp(str) { + return new RegExp(str.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&')); +} + function cloudronDomain(filename) { return 't' + path.basename(filename.replace(/-/g,''), 'test.js') + '.selfhost.io'; } diff --git a/test/cloudron-backup-test.js b/test/cloudron-backup-test.js index 826eac4..8571b73 100644 --- a/test/cloudron-backup-test.js +++ b/test/cloudron-backup-test.js @@ -81,8 +81,8 @@ describe('Cloudron backup testing', function () { it('did send mail from cloudron user', function (done) { imap.probe({ - subject: new RegExp('^Hi from e2e test - ' + cloudron.fqdn() + '$'), - to: new RegExp('test+' + cloudron.fqdn() + '@cloudron.io'), + subject: common.regexp('^Hi from e2e test - ' + cloudron.fqdn() + '$'), + to: common.regexp('test+' + cloudron.fqdn() + '@cloudron.io'), body: /This release depends on you/ }, done); });