File tree Expand file tree Collapse file tree 2 files changed +16
-10
lines changed
Expand file tree Collapse file tree 2 files changed +16
-10
lines changed Original file line number Diff line number Diff line change @@ -77,14 +77,20 @@ export const EndpointsJsonResponse = ({
7777 return { } ;
7878 }
7979
80- const url = new URL ( val ) ;
81-
82- const paths = sanitizeArray ( url . pathname . split ( "/" ) ) . map ( ( pn ) => {
83- // Remove { "%7B" character
84- return pn . replace ( "%7B" , "" ) ;
85- } ) ;
86-
87- return { paths, searchParams : url . searchParams } ;
80+ try {
81+ const decodedUrl = decodeURIComponent ( val ) ;
82+ const url = new URL ( decodedUrl ) ;
83+
84+ const paths = sanitizeArray ( url . pathname . split ( "/" ) ) . map ( ( pn ) => {
85+ // Remove { "%7B" and } "%7D" characters
86+ return pn . replaceAll ( "%7B" , "" ) . replaceAll ( "%7D" , "" ) ;
87+ } ) ;
88+
89+ return { paths, searchParams : url . searchParams } ;
90+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
91+ } catch ( e ) {
92+ return { } ;
93+ }
8894 } ;
8995
9096 const handleLinkHref = ( val : string ) => {
Original file line number Diff line number Diff line change @@ -20,9 +20,9 @@ export const initTracking = () => {
2020
2121 const { hostname } = window . location ;
2222
23- if ( hostname === "lab.stellar.org" ) {
23+ if ( [ "lab.stellar.org" ] . includes ( hostname ) ) {
2424 apiKey = AMPLITUDE_API_KEY_PROD ;
25- } else if ( hostname . includes ( " previews.kube001.services.stellar-ops.com") ) {
25+ } else if ( hostname . endsWith ( ". previews.kube001.services.stellar-ops.com") ) {
2626 apiKey = AMPLITUDE_API_KEY_DEV ;
2727 }
2828
You can’t perform that action at this time.
0 commit comments