client: redirect /private/ and /protected/ links to /post to handle backwards compat

This commit is contained in:
Max Leiter 2022-04-12 16:54:02 -07:00
parent 67e1b9889b
commit 16d5780110
No known key found for this signature in database
GPG key ID: A3512F2F2F17EBDA

View file

@ -49,6 +49,11 @@ export function middleware(req: NextRequest, event: NextFetchEvent) {
return NextResponse.redirect(getURL("signin"))
}
}
if (pathname.includes("/protected/") || pathname.includes("/private/")) {
const urlWithoutVisibility = pathname.replace("/protected/", "/").replace("/private/", "/").substring(1)
return NextResponse.redirect(getURL(urlWithoutVisibility))
}
}
return NextResponse.next()