fix: handle legacy redirects and media previews
This commit is contained in:
@@ -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,
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user