Skip to content

Commit

Permalink
Updates random entry redirector
Browse files Browse the repository at this point in the history
  • Loading branch information
davidmerfield committed Aug 31, 2022
1 parent 43bdf34 commit cb3c078
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions app/blog/random.js
Expand Up @@ -8,10 +8,9 @@ module.exports = function (server) {
if (err || !entryIDs || !entryIDs.length) return next();
const entryID = randomFrom(entryIDs);
Entry.get(req.blog.id, entryID, function (entry) {
if (err || !entry) return next();
if (err || !entry || !entry.url) return next();
res.set("Cache-Control", "no-cache");
// res.redirect does a 302 by default but let's be explicit
res.redirect(302, entry.url);
res.redirect(entry.url);
});
});
});
Expand Down

0 comments on commit cb3c078

Please sign in to comment.