зеркало из https://github.com/github/docs.git
use the referrer exclusively for asset paths
This commit is contained in:
Родитель
60b834012b
Коммит
dbcb3a5cee
|
@ -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()
|
||||||
|
|
Загрузка…
Ссылка в новой задаче