Fix getSafeReferrer when referrer is null

This commit is contained in:
Calvin Montgomery 2017-08-24 20:55:18 -07:00
parent cc69b3c225
commit 3d50b8f52e
1 changed files with 5 additions and 0 deletions

View File

@ -20,6 +20,11 @@ const LOGGER = require('@calzoneman/jsli')('web/auth');
function getSafeReferrer(req) { function getSafeReferrer(req) {
const referrer = req.header('referer'); const referrer = req.header('referer');
if (!referrer) {
return null;
}
const { hostname } = url.parse(referrer); const { hostname } = url.parse(referrer);
// TODO: come back to this when refactoring http alt domains // TODO: come back to this when refactoring http alt domains