fix: handle legacy redirects and media previews

This commit is contained in:
Codex
2026-06-02 11:32:49 +08:00
parent 5a59fcd96b
commit efab08ea26
12 changed files with 251 additions and 67 deletions
+17
View File
@@ -0,0 +1,17 @@
import type { NextRequest } from 'next/server'
import { resolveCmsRedirect } from '@/lib/cms-redirect'
export const dynamic = 'force-dynamic'
export const revalidate = 0
export async function GET(request: NextRequest) {
const pathname = request.nextUrl.pathname
const normalizedTutorialPage = pathname.match(/^\/Support\/tutorial\/target\/([^/]+)\/p\/\d+\.html$/)
return resolveCmsRedirect({
pathname: normalizedTutorialPage
? `/Support/tutorial/target/${normalizedTutorialPage[1]}.html`
: undefined,
request,
})
}