File tree 2 files changed +2
-4
lines changed 2 files changed +2
-4
lines changed Original file line number Diff line number Diff line change @@ -47,11 +47,10 @@ test('parseIssueHref', () => {
47
47
48
48
test ( 'parseRepoOwnerPathInfo' , ( ) => {
49
49
expect ( parseRepoOwnerPathInfo ( '/owner/repo/issues/new' ) ) . toEqual ( { ownerName : 'owner' , repoName : 'repo' } ) ;
50
- expect ( parseRepoOwnerPathInfo ( '/owner/repo/issues/new?query' ) ) . toEqual ( { ownerName : 'owner' , repoName : 'repo' } ) ;
51
50
expect ( parseRepoOwnerPathInfo ( '/owner/repo/releases' ) ) . toEqual ( { ownerName : 'owner' , repoName : 'repo' } ) ;
52
51
expect ( parseRepoOwnerPathInfo ( '/other' ) ) . toEqual ( { } ) ;
53
52
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' } ) ;
55
54
expect ( parseRepoOwnerPathInfo ( '/sub/owner/repo/compare/feature/branch-1...fix/branch-2' ) ) . toEqual ( { ownerName : 'owner' , repoName : 'repo' } ) ;
56
55
window . config . appSubUrl = '' ;
57
56
} ) ;
Original file line number Diff line number Diff line change @@ -41,8 +41,7 @@ export function parseIssueHref(href: string): IssuePathInfo {
41
41
export function parseRepoOwnerPathInfo ( pathname : string ) : RepoOwnerPathInfo {
42
42
const appSubUrl = window . config . appSubUrl ;
43
43
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 ) || [ ] ;
46
45
return { ownerName, repoName} ;
47
46
}
48
47
You can’t perform that action at this time.
0 commit comments