fix(admin): repair media upload redirect

This commit is contained in:
Schubert Ferenc 2026-07-03 23:15:25 +02:00
parent c35bd5877e
commit 203c94b128
12 changed files with 248 additions and 51 deletions

View file

@ -7,7 +7,9 @@ export function proxy(request: NextRequest) {
if (!pathname.startsWith("/admin") || pathname === "/admin/login") return NextResponse.next();
if (!request.cookies.get(adminSessionCookie)?.value) {
const loginUrl = new URL("/admin/login", request.url);
const loginUrl = request.nextUrl.clone();
loginUrl.pathname = "/admin/login";
loginUrl.search = "";
loginUrl.searchParams.set("next", pathname);
return NextResponse.redirect(loginUrl);
}