From 53d17bcfdd1b3a05962f51b97b72e0f0d161531f Mon Sep 17 00:00:00 2001 From: Grzegorz Godlewski Date: Tue, 2 Jul 2024 23:24:36 +0200 Subject: [PATCH] Fix redirect --- src/containers/server/auth.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/containers/server/auth.ts b/src/containers/server/auth.ts index 214d7599..f12d07ae 100644 --- a/src/containers/server/auth.ts +++ b/src/containers/server/auth.ts @@ -150,6 +150,14 @@ export async function handleShare(req: Request, res: Response, next) { export async function handlePopupClose(req: Request, res: Response, next) { try { const state = new URLSearchParams(req.query.state.toString()); + if (!process.env.AUTH_INSTANCE) { // main auth host + const instance = state.get('instance'); + if (instance && instance.match(/^pr-\d+$/)) { + next(); + return; + } + } + if (state.get('popupWindow') === 'true') { openerRedirect(res, req.url.replace('popupWindow', '')); return;