File tree Expand file tree Collapse file tree 1 file changed +11
-1
lines changed
source/pages/oss-licenses Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -40,7 +40,17 @@ Page({
4040 version : this . data . licensesBuild [ index ] . version ,
4141 licenseBody : this . data . licensesBuild [ index ] . licenseText ,
4242 repoLink : this . data . licensesBuild [ index ] . repository ,
43- repoType : this . data . licensesBuild [ index ] . repository . toLowerCase ( ) . includes ( "github.com" ) ? "GitHub" : ( this . data . licensesBuild [ index ] . repository . toLowerCase ( ) . includes ( "gitlab.com" ) ? "GitLab" : "Unknown" )
43+ repoType : ( ( ) => {
44+ try {
45+ const url = new URL ( this . data . licensesBuild [ index ] . repository ) ;
46+ const host = url . host . toLowerCase ( ) ;
47+ if ( host === "github.com" ) return "GitHub" ;
48+ if ( host === "gitlab.com" ) return "GitLab" ;
49+ } catch ( e ) {
50+ console . error ( "Invalid URL:" , e ) ;
51+ }
52+ return "Unknown" ;
53+ } ) ( )
4454 } )
4555 } , onUnload ( ) {
4656 this . storeBindings . destroyStoreBindings ( ) ;
You can’t perform that action at this time.
0 commit comments