File tree Expand file tree Collapse file tree 1 file changed +8
-3
lines changed
Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -20,7 +20,7 @@ const defaultDeeplinkWhitelist = ['https:'] as const;
2020const defaultDeeplinkBlocklist = [ `http:` , `file:` , `javascript:` ] as const ;
2121
2222const stringWhitelistToRegex = ( originWhitelist : string ) : RegExp =>
23- new RegExp ( `^ ${ escapeStringRegexp ( originWhitelist ) . replace ( / \\ \* / g , '.*' ) } $` ) ;
23+ new RegExp ( escapeStringRegexp ( originWhitelist ) . replace ( / ^ ( h t t p s ? : \/ \/ | m a i l t o : ) . * / , '^$1.*$' ) ) ;
2424
2525const matchWithRegexList = (
2626 compiledRegexList : readonly RegExp [ ] ,
@@ -42,8 +42,13 @@ const _passesWhitelist = (
4242 url : string ,
4343) => {
4444 try {
45- const { origin } = new URL ( url )
46- return origin && matchWithRegexList ( compiledWhitelist , origin )
45+ const { href, origin } = new URL ( url )
46+
47+ if ( origin && origin !== 'null' ) {
48+ return matchWithRegexList ( compiledWhitelist , origin ) ;
49+ }
50+
51+ return matchWithRegexList ( compiledWhitelist , href )
4752 } catch {
4853 return false
4954 }
You can’t perform that action at this time.
0 commit comments