From d6d40a974ea905592c9c56c94b8d98979eaa50be Mon Sep 17 00:00:00 2001 From: Kevin Heis Date: Tue, 2 Nov 2021 11:24:32 -0700 Subject: [PATCH] 500 on /en/enterprise-server@2.16/admin (#22532) * 500 on /en/enterprise-server@2.16/admin * Update release-notes.js --- middleware/contextualizers/release-notes.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/middleware/contextualizers/release-notes.js b/middleware/contextualizers/release-notes.js index 56c0d54bca70..d241466ec7a3 100644 --- a/middleware/contextualizers/release-notes.js +++ b/middleware/contextualizers/release-notes.js @@ -20,6 +20,7 @@ export default async function releaseNotesContext(req, res, next) { if (!(req.pagePath.endsWith('/release-notes') || req.pagePath.endsWith('/admin'))) return next() const [requestedPlan, requestedRelease] = req.context.currentVersion.split('@') + const releaseNotesPerPlan = req.context.site.data['release-notes'][requestedPlan] // Release notes handling differs if version has numbered releases (like GHES) or not (like GHAE) @@ -33,7 +34,7 @@ export default async function releaseNotesContext(req, res, next) { if (hasNumberedReleases) { const currentReleaseNotes = releaseNotesPerPlan[`${requestedRelease.replace(/\./g, '-')}`] - if (!currentReleaseNotes && req.pagePath.endsWith('/release-notes')) { + if (!currentReleaseNotes) { // If the GHES version doesn't have any release notes, let's be helpful and redirect to `enterprise.github.com` return requestedPlan === 'enterprise-server' ? res.redirect(`https://enterprise.github.com/releases/${requestedRelease}.0/notes`)