File tree Expand file tree Collapse file tree 3 files changed +16
-5
lines changed
Expand file tree Collapse file tree 3 files changed +16
-5
lines changed Original file line number Diff line number Diff line change @@ -27,6 +27,9 @@ export class HomeView {
2727 const repoName = utils . getGithubRepositoryPath (
2828 utils . parseRepositoryUrl ( repository )
2929 )
30+ if ( repoName === null ) {
31+ return ;
32+ }
3033
3134 fetchScorecardData ( repoName ) . then ( ( data ) => {
3235 if ( data !== null ) {
Original file line number Diff line number Diff line change @@ -24,6 +24,9 @@ export class Scorecard {
2424 }
2525
2626 const repoName = utils . getGithubRepositoryPath ( githubURL . href ) ;
27+ if ( repoName === null ) {
28+ return ;
29+ }
2730 const pannel = clone . getElementById ( "pan-scorecard" ) ;
2831 fetchScorecardData ( repoName ) . then ( ( data ) => {
2932 if ( ! data ) {
Original file line number Diff line number Diff line change @@ -4,12 +4,17 @@ import avatarURL from "../img/avatar-default.png";
44window . activeLegendElement = null ;
55
66export function getGithubRepositoryPath ( url ) {
7- const github = new URL ( url ) ;
7+ try {
8+ const github = new URL ( url ) ;
89
9- return github . pathname . slice (
10- 1 ,
11- github . pathname . includes ( ".git" ) ? - 4 : github . pathname . length
12- ) ;
10+ return github . pathname . slice (
11+ 1 ,
12+ github . pathname . includes ( ".git" ) ? - 4 : github . pathname . length
13+ ) ;
14+ }
15+ catch {
16+ return null ;
17+ }
1318}
1419
1520/**
You can’t perform that action at this time.
0 commit comments