Encode List-ID header, allow access to campaigns with deleted list

This commit is contained in:
Andris Reinman 2016-08-10 20:45:29 +03:00
parent 0b6d549af4
commit fb7fd7238f
4 changed files with 29 additions and 21 deletions

View file

@ -465,10 +465,9 @@ module.exports.create = (campaign, opts, callback) => {
if (err) {
return callback(err);
}
if (!list) {
return callback(new Error('Selected list not found'));
}
return callback(null, list);
return callback(null, list || {
id: listId
});
});
};
@ -649,10 +648,9 @@ module.exports.update = (id, updates, callback) => {
if (err) {
return callback(err);
}
if (!list) {
return callback(new Error('Selected list not found'));
}
return callback(null, list);
return callback(null, list || {
id: listId
});
});
};

View file

@ -38,7 +38,7 @@
"connect-redis": "^3.1.0",
"cookie-parser": "^1.4.3",
"csurf": "^1.9.0",
"csv-parse": "^1.1.2",
"csv-parse": "^1.1.7",
"escape-html": "^1.0.3",
"express": "^4.14.0",
"express-session": "^1.14.0",
@ -51,25 +51,26 @@
"html-to-text": "^2.1.3",
"humanize": "0.0.9",
"is-url": "^1.2.2",
"isemail": "^2.2.0",
"isemail": "^2.2.1",
"jsdom": "^9.4.1",
"juice": "^2.0.0",
"libmime": "^2.0.3",
"mkdirp": "^0.5.1",
"moment-timezone": "^0.5.4",
"moment-timezone": "^0.5.5",
"morgan": "^1.7.0",
"multer": "^1.1.0",
"multer": "^1.2.0",
"mysql": "^2.11.1",
"nodemailer": "^2.5.0",
"nodemailer-openpgp": "^1.0.2",
"npmlog": "^3.1.2",
"npmlog": "^4.0.0",
"openpgp": "^2.3.2",
"passport": "^0.3.2",
"passport-local": "^1.0.0",
"request": "^2.73.0",
"request": "^2.74.0",
"serve-favicon": "^2.3.0",
"shortid": "^2.2.6",
"slugify": "^0.1.1",
"smtp-server": "^1.11.0",
"slugify": "^1.0.2",
"smtp-server": "^1.14.0",
"striptags": "^2.1.1",
"toml": "^2.3.0"
}

View file

@ -171,7 +171,9 @@ router.get('/edit/:id', passport.csrfProtection, (req, res, next) => {
return callback(err);
}
if (!list) {
return callback(new Error('Selected list not found'));
list = {
id: listId
};
}
fields.list(list.id, (err, fieldList) => {
@ -330,7 +332,9 @@ router.get('/view/:id', passport.csrfProtection, (req, res) => {
return callback(err);
}
if (!list) {
return callback(new Error('Selected list not found'));
list = {
id: listId
};
}
subscriptions.listTestUsers(listId, (err, testUsers) => {
if (err || !testUsers) {
@ -468,7 +472,9 @@ router.get('/status/:id/:status', passport.csrfProtection, (req, res) => {
return callback(err);
}
if (!list) {
return callback(new Error('Selected list not found'));
list = {
id: listId
};
}
return callback(null, list);
});
@ -506,7 +512,9 @@ router.get('/clicked/:id/:linkId', passport.csrfProtection, (req, res) => {
return callback(err);
}
if (!list) {
return callback(new Error('Selected list not found'));
list = {
id: listId
};
}
return callback(null, list);
});

View file

@ -16,6 +16,7 @@ let url = require('url');
let htmlToText = require('html-to-text');
let request = require('request');
let caches = require('../lib/caches');
let libmime = require('libmime');
function findUnsent(callback) {
let returnUnsent = (row, campaign) => {
@ -307,7 +308,7 @@ function formatMessage(message, callback) {
}),
'List-ID': {
prepared: true,
value: '"' + list.name.replace(/[^a-z0-9\s'.,\-]/g, '').trim() + '" <' + list.cid + '.' + (url.parse(configItems.serviceUrl).hostname || 'localhost') + '>'
value: libmime.encodeWords(list.name) + ' <' + list.cid + '.' + (url.parse(configItems.serviceUrl).hostname || 'localhost') + '>'
}
},
list: {