Skip to content

Commit 2712cf5

Browse files
fix: Opening link for Packager or SBOMs related to Licenses in new window ignores the filter (#922)
1 parent 56d5583 commit 2712cf5

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

client/src/app/components/OidcProvider.tsx

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,17 @@ export const OidcProvider: React.FC<IOidcProviderProps> = ({ children }) => {
2929
automaticSilentRenew={true}
3030
onSigninCallback={() => {
3131
const params = new URLSearchParams(window.location.search);
32-
const relativePath = params.get("state")?.split(";")?.[1];
33-
AppRoutes.navigate(relativePath ?? "/", { replace: true });
32+
const fullPath = params.get("state")?.split(";")?.[1] ?? "/";
33+
34+
// Parse pathname and search from the preserved full URL
35+
const [pathname, search] = fullPath.includes("?")
36+
? fullPath.split("?", 2)
37+
: [fullPath, ""];
38+
39+
AppRoutes.navigate(
40+
{ pathname, search: search ? `?${search}` : "" },
41+
{ replace: true },
42+
);
3443
}}
3544
>
3645
<AuthEnabledOidcProvider>{children}</AuthEnabledOidcProvider>
@@ -46,7 +55,7 @@ const AuthEnabledOidcProvider: React.FC<IOidcProviderProps> = ({
4655
React.useEffect(() => {
4756
if (!auth.isAuthenticated && !auth.isLoading && !auth.error) {
4857
auth.signinRedirect({
49-
url_state: window.location.pathname,
58+
url_state: window.location.pathname + window.location.search,
5059
});
5160
}
5261
}, [auth.isAuthenticated, auth.isLoading, auth.error, auth.signinRedirect]);

0 commit comments

Comments
 (0)