Skip to content

Commit

Permalink
500 on /en/[email protected]/admin (github#22532)
Browse files Browse the repository at this point in the history
* 500 on /en/[email protected]/admin

* Update release-notes.js
  • Loading branch information
heiskr authored Nov 2, 2021
1 parent 2eb1afb commit d6d40a9
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion middleware/contextualizers/release-notes.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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`)
Expand Down

0 comments on commit d6d40a9

Please sign in to comment.