File tree Expand file tree Collapse file tree 1 file changed +12
-2
lines changed
packages/frontend/core/src/utils Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Original file line number Diff line number Diff line change 11export function popupWindow ( target : string ) {
2- const url = new URL ( BUILD_CONFIG . serverUrlPrefix + '/redirect-proxy' ) ;
32 target = / ^ h t t p s ? : \/ \/ / . test ( target )
43 ? target
54 : BUILD_CONFIG . serverUrlPrefix + target ;
6- url . searchParams . set ( 'redirect_uri' , target ) ;
5+ const targetUrl = new URL ( target ) ;
6+
7+ let url : string ;
8+ // safe to open directly if in the same origin
9+ if ( targetUrl . origin === location . origin ) {
10+ url = target ;
11+ } else {
12+ const builder = new URL ( BUILD_CONFIG . serverUrlPrefix + '/redirect-proxy' ) ;
13+ builder . searchParams . set ( 'redirect_uri' , target ) ;
14+ url = builder . toString ( ) ;
15+ }
16+
717 return window . open ( url , '_blank' , `noreferrer noopener` ) ;
818}
You can’t perform that action at this time.
0 commit comments