File tree Expand file tree Collapse file tree 1 file changed +10
-6
lines changed
Expand file tree Collapse file tree 1 file changed +10
-6
lines changed Original file line number Diff line number Diff line change 11/**
2- * Redirect legacy URLs to canonical paths (client-side only)
2+ * Redirect legacy/shorthand URLs to canonical paths.
33 *
4+ * Handled here:
5+ * - /@org/pkg or /pkg → /package/@org/pkg or /package/pkg
6+ * - /@org/pkg/v/ver or /pkg@ver → /package/@org/pkg/v/ver or /package/pkg/v/ver
7+ * - /@org → /org/org
8+ *
9+ * Handled via route aliases (not here):
410 * - /package/code/* → /package-code/*
5- * - /code/* → /package-code/*
11+ * - /code/* → /package-code/*
612 * - /package/docs/* → /package-docs/*
7- * - /docs/* → /package-docs/*
8- * - /org/* → /@*
9- * - /* → /package/* (Unless it's an existing page)
13+ * - /docs/* → /package-docs/*
1014 */
1115const pages = [
1216 '/about' ,
@@ -49,7 +53,7 @@ export default defineEventHandler(async event => {
4953 return sendRedirect ( event , `/package/${ args } /v/${ pkgVersionMatch . groups . version } ` )
5054 }
5155
52- // /org/* → /@*
56+ // /@ org → /org/org
5357 const orgMatch = path . match ( / ^ \/ @ (?< org > [ ^ / ] + ) $ / )
5458 if ( orgMatch ?. groups ) {
5559 return sendRedirect ( event , `/org/${ orgMatch . groups . org } ` )
You can’t perform that action at this time.
0 commit comments