File tree Expand file tree Collapse file tree 2 files changed +2
-4
lines changed Expand file tree Collapse file tree 2 files changed +2
-4
lines changed Original file line number Diff line number Diff line change @@ -47,11 +47,10 @@ test('parseIssueHref', () => {
4747
4848test ( 'parseRepoOwnerPathInfo' , ( ) => {
4949 expect ( parseRepoOwnerPathInfo ( '/owner/repo/issues/new' ) ) . toEqual ( { ownerName : 'owner' , repoName : 'repo' } ) ;
50- expect ( parseRepoOwnerPathInfo ( '/owner/repo/issues/new?query' ) ) . toEqual ( { ownerName : 'owner' , repoName : 'repo' } ) ;
5150 expect ( parseRepoOwnerPathInfo ( '/owner/repo/releases' ) ) . toEqual ( { ownerName : 'owner' , repoName : 'repo' } ) ;
5251 expect ( parseRepoOwnerPathInfo ( '/other' ) ) . toEqual ( { } ) ;
5352 window . config . appSubUrl = '/sub' ;
54- expect ( parseRepoOwnerPathInfo ( '/sub/owner/repo/issues/new#hash ' ) ) . toEqual ( { ownerName : 'owner' , repoName : 'repo' } ) ;
53+ expect ( parseRepoOwnerPathInfo ( '/sub/owner/repo/issues/new' ) ) . toEqual ( { ownerName : 'owner' , repoName : 'repo' } ) ;
5554 expect ( parseRepoOwnerPathInfo ( '/sub/owner/repo/compare/feature/branch-1...fix/branch-2' ) ) . toEqual ( { ownerName : 'owner' , repoName : 'repo' } ) ;
5655 window . config . appSubUrl = '' ;
5756} ) ;
Original file line number Diff line number Diff line change @@ -41,8 +41,7 @@ export function parseIssueHref(href: string): IssuePathInfo {
4141export function parseRepoOwnerPathInfo ( pathname : string ) : RepoOwnerPathInfo {
4242 const appSubUrl = window . config . appSubUrl ;
4343 if ( appSubUrl && pathname . startsWith ( appSubUrl ) ) pathname = pathname . substring ( appSubUrl . length ) ;
44- const path = ( pathname || '' ) . replace ( / [ # ? ] .* $ / , '' ) ;
45- const [ _ , ownerName , repoName ] = / ( [ ^ / ] + ) \/ ( [ ^ / ] + ) / . exec ( path ) || [ ] ;
44+ const [ _ , ownerName , repoName ] = / ( [ ^ / ] + ) \/ ( [ ^ / ] + ) / . exec ( pathname ) || [ ] ;
4645 return { ownerName, repoName} ;
4746}
4847
You can’t perform that action at this time.
0 commit comments