use the referrer exclusively for asset paths

This commit is contained in:
Sarah Schneider 2020-11-18 14:50:58 -05:00
Родитель 60b834012b
Коммит dbcb3a5cee
1 изменённых файлов: 3 добавлений и 1 удалений

Просмотреть файл

@ -4,7 +4,9 @@ const { deprecated } = require('../lib/enterprise-server-releases')
module.exports = async (req, res, next) => { module.exports = async (req, res, next) => {
// if this is an assets path, use the referrer // if this is an assets path, use the referrer
// if this is a docs path, use the req.path // if this is a docs path, use the req.path
const pathToCheck = req.get('referrer') || req.path const pathToCheck = patterns.assetPaths.test(req.path)
? req.get('referrer')
: req.path
// ignore paths that don't have an enterprise version number // ignore paths that don't have an enterprise version number
if (!(patterns.getEnterpriseVersionNumber.test(pathToCheck) || patterns.getEnterpriseServerNumber.test(pathToCheck))) return next() if (!(patterns.getEnterpriseVersionNumber.test(pathToCheck) || patterns.getEnterpriseServerNumber.test(pathToCheck))) return next()