File tree Expand file tree Collapse file tree 3 files changed +13
-20
lines changed
pages/en/download/archive Expand file tree Collapse file tree 3 files changed +13
-20
lines changed Original file line number Diff line number Diff line change 11import { notFound } from 'next/navigation' ;
22import type { FC } from 'react' ;
3- import semVer from 'semver' ;
43
54import { getClientContext } from '#site/client-context' ;
65import provideReleaseData from '#site/next-data/providers/releaseData' ;
@@ -27,16 +26,17 @@ const WithDownloadArchive: FC<WithDownloadArchiveProps> = async ({
2726 // Extract version from pathname
2827 const version = extractVersionFromPath ( pathname ) ;
2928
30- if ( version == null ) {
31- return notFound ( ) ;
32- }
33-
3429 // Find the release data for the given version
3530 const releaseData = provideReleaseData ( ) ;
36- const release = releaseData . find (
37- release => semVer . major ( version ) === release . major
31+ const release = releaseData . find ( release =>
32+ // Match major version only (e.g., v22.x.x for release.major v22)
33+ version . startsWith ( `v${ release . major } ` )
3834 ) ! ;
3935
36+ if ( ! release ) {
37+ return notFound ( ) ;
38+ }
39+
4040 const releaseArtifacts = buildReleaseArtifacts ( release , version ) ;
4141
4242 return < Component { ...releaseArtifacts } /> ;
Original file line number Diff line number Diff line change @@ -24,7 +24,9 @@ layout: download-archive
2424 <ReleaseOverview release = { release } />
2525
2626 <ul className = ' flex list-none flex-col gap-2 p-0 text-sm' >
27-
27+ <li >
28+ Read the <LinkWithArrow href = { ` https://github.com/nodejs/node/releases/tag/${version } ` } >changelog</LinkWithArrow > or <Link href = { ` /blog/release/${version } ` } >blog post</Link > for this version.
29+ </li >
2830 <li >
2931 Learn more about <Link href = " /about/previous-releases" >Node.js releases</Link >, including the release schedule and LTS status.
3032 </li >
Original file line number Diff line number Diff line change @@ -140,19 +140,10 @@ export const buildReleaseArtifacts = (
140140 * Extracts the version from the pathname.
141141 * It expects the version to be in the format like 'v22.0.4'.
142142 */
143- export const extractVersionFromPath = ( pathname : string | undefined ) => {
144- if ( ! pathname ) {
145- return null ;
146- }
147-
143+ export const extractVersionFromPath = ( pathname : string ) => {
148144 const segments = pathname . split ( '/' ) . filter ( Boolean ) ;
149- const version = segments . pop ( ) ;
150-
151- // Checks the version prefix + digits + optional dot-separated digits
152- // (v22, v22.0.4)
153- if ( ! version || ! version . match ( / ^ v \d + ( \. \d + ) * $ / ) ) {
154- return null ;
155- }
145+ // The version is expected to be the last segment in the path
146+ const version = segments . pop ( ) ! ;
156147
157148 return version ;
158149} ;
You can’t perform that action at this time.
0 commit comments