From dbcb3a5ceeeecb589b6d64d640c4dedf8a12b824 Mon Sep 17 00:00:00 2001 From: Sarah Schneider Date: Wed, 18 Nov 2020 14:50:58 -0500 Subject: [PATCH] use the referrer exclusively for asset paths --- middleware/is-archived-version.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/middleware/is-archived-version.js b/middleware/is-archived-version.js index e14d2becbb..ac5afb6566 100644 --- a/middleware/is-archived-version.js +++ b/middleware/is-archived-version.js @@ -4,7 +4,9 @@ const { deprecated } = require('../lib/enterprise-server-releases') module.exports = async (req, res, next) => { // if this is an assets path, use the referrer // 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 if (!(patterns.getEnterpriseVersionNumber.test(pathToCheck) || patterns.getEnterpriseServerNumber.test(pathToCheck))) return next()