Show 404 error for unresolved tracking urls
This commit is contained in:
parent
6eed682d93
commit
e2ae925b97
2 changed files with 13 additions and 1 deletions
|
@ -18,7 +18,7 @@ module.exports.resolve = (campaignCid, linkCid, callback) => {
|
||||||
return callback(err);
|
return callback(err);
|
||||||
}
|
}
|
||||||
if (!campaign) {
|
if (!campaign) {
|
||||||
return callback('Campaign not found');
|
return callback(null, false);
|
||||||
}
|
}
|
||||||
db.getConnection((err, connection) => {
|
db.getConnection((err, connection) => {
|
||||||
if (err) {
|
if (err) {
|
||||||
|
|
|
@ -36,6 +36,18 @@ router.get('/:campaign/:list/:subscription/:link', (req, res, next) => {
|
||||||
req.flash('danger', err.message || err);
|
req.flash('danger', err.message || err);
|
||||||
return res.redirect('/');
|
return res.redirect('/');
|
||||||
}
|
}
|
||||||
|
if (!linkId || !url) {
|
||||||
|
log.error('Redirect', 'Unresolved URL: <%s>', req.url);
|
||||||
|
res.status(404);
|
||||||
|
return res.render('archive/view', {
|
||||||
|
layout: 'archive/layout',
|
||||||
|
message: 'Oops, we couldn\'t find a link for the URL you clicked',
|
||||||
|
campaign: {
|
||||||
|
subject: 'Error 404'
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
links.countClick(req.ip, req.params.campaign, req.params.list, req.params.subscription, linkId, (err, status) => {
|
links.countClick(req.ip, req.params.campaign, req.params.list, req.params.subscription, linkId, (err, status) => {
|
||||||
if (err) {
|
if (err) {
|
||||||
log.error('Redirect', err.stack || err);
|
log.error('Redirect', err.stack || err);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue