@@ -589,7 +589,7 @@ export function DashboardPage() {
589589 < >
590590 < div className = "p-4 bg-white rounded-lg border" >
591591 < QRCodeSVG
592- value = { `${ dashboardData . sub_url } /${ qrUser . sub_id ?. replace ( '/' , '' ) } ` }
592+ value = { `${ dashboardData . sub_url } /${ qrUser . sub_id ?. replace ( / ^ \/ + | \/ + $ / g , '' ) } ` }
593593 size = { 200 }
594594 level = "M"
595595 />
@@ -599,7 +599,7 @@ export function DashboardPage() {
599599 < p > < strong > User:</ strong > { qrUser ?. username } </ p >
600600 </ div >
601601 < div className = "p-3 bg-muted rounded-md break-all text-xs font-mono" >
602- { `${ dashboardData . sub_url } /${ qrUser . sub_id ?. replace ( '/' , '' ) } ` }
602+ { `${ dashboardData . sub_url } /${ qrUser . sub_id ?. replace ( new RegExp ( `^ ${ dashboardData . sub_url . replace ( / [ . * + ? ^ $ { } ( ) | [ \] \\ ] / g , '\\$&' ) } ` ) , '' ) . replace ( / ^ \/ + / , '' ) } ` }
603603 </ div >
604604 </ div >
605605 </ >
@@ -720,7 +720,7 @@ function DetailsRow({
720720 { subUrl && user . sub_id && (
721721 < div className = "p-3 bg-background rounded-md border" >
722722 < div className = "text-xs text-muted-foreground mb-1" > Subscription Link:</ div >
723- < div className = "text-xs font-mono break-all" > { `${ subUrl } /${ user . sub_id ?. replace ( '/' , '' ) } ` } </ div >
723+ < div className = "text-xs font-mono break-all" > { `${ subUrl } /${ user . sub_id ?. replace ( new RegExp ( `^ ${ subUrl . replace ( / [ . * + ? ^ $ { } ( ) | [ \] \\ ] / g , '\\$&' ) } ` ) , '' ) . replace ( / ^ \/ + / , '' ) } ` } </ div >
724724 </ div >
725725 ) }
726726 < div className = "flex flex-wrap gap-2 pt-2" >
@@ -737,7 +737,7 @@ function DetailsRow({
737737 size = "sm"
738738 variant = "outline"
739739 onClick = { ( ) => {
740- navigator . clipboard . writeText ( `${ subUrl } /${ user . sub_id ?. replace ( '/' , '' ) || user . sub_id } ` )
740+ navigator . clipboard . writeText ( `${ subUrl } /${ user . sub_id ?. replace ( new RegExp ( `^ ${ subUrl . replace ( / [ . * + ? ^ $ { } ( ) | [ \] \\ ] / g , '\\$&' ) } ` ) , '' ) . replace ( / ^ \/ + / , '' ) || user . sub_id } ` )
741741 } }
742742 >
743743 < Copy className = "h-4 w-4 mr-2" />
@@ -896,7 +896,7 @@ function MobileUserCard({
896896 className = "flex-1 min-w-[80px]"
897897 onClick = { ( e ) => {
898898 e . stopPropagation ( )
899- navigator . clipboard . writeText ( `${ subUrl } /${ user . sub_id ?. replace ( '/' , '' ) || user . sub_id } ` )
899+ navigator . clipboard . writeText ( `${ subUrl } /${ user . sub_id ?. replace ( new RegExp ( `^ ${ subUrl . replace ( / [ . * + ? ^ $ { } ( ) | [ \] \\ ] / g , '\\$&' ) } ` ) , '' ) . replace ( / ^ \/ + / , '' ) || user . sub_id } ` )
900900 } }
901901 >
902902 < Copy className = "h-3 w-3 mr-1" />
0 commit comments