File tree Expand file tree Collapse file tree
client-runtime/src/operations
source-control-core/src/shared Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -69,6 +69,12 @@ describe("add project shared logic", () => {
6969 expect ( normalizePastedCloneUrl ( "https://gitlab.com/team/platform/src/branch/repo.git" ) ) . toBe (
7070 "https://gitlab.com/team/platform/src/branch/repo.git" ,
7171 ) ;
72+ expect (
73+ normalizePastedCloneUrl ( "https://gitlab.example.com/team/platform/src/branch/repo.git" ) ,
74+ ) . toBe ( "https://gitlab.example.com/team/platform/src/branch/repo.git" ) ;
75+ expect (
76+ normalizePastedCloneUrl ( "https://git.example.com/team/platform/src/branch/repo.git" ) ,
77+ ) . toBe ( "https://git.example.com/team/platform/src/branch/repo.git" ) ;
7278 } ) ;
7379
7480 it . each ( [
Original file line number Diff line number Diff line change @@ -740,14 +740,11 @@ export function makeSourceControlDefinitionRegistry(
740740 repositoryUrlFromPageUrl : ( value ) => {
741741 const url = httpUrl ( value ) ;
742742 if ( url === null ) return null ;
743- // Another host's any-hostname pattern can misread a public host's path, such as a GitLab
744- // group named `src`, so a public host's URLs are read only by that host.
745- const owner = findByPublicDomain ( url . hostname ) ;
746- for ( const definition of owner ? [ owner ] : claimOrder ) {
747- const repositoryUrl = definition . repositoryUrlFromPageUrl ?.( url ) ;
748- if ( repositoryUrl != null ) return repositoryUrl ;
749- }
750- return null ;
743+ // Page routes can also be valid repository paths on another provider.
744+ const owner =
745+ findByPublicDomain ( url . hostname ) ??
746+ recognitionOrder . find ( ( definition ) => recognizeRemoteWith ( definition , value ) !== null ) ;
747+ return owner ?. repositoryUrlFromPageUrl ?.( url ) ?? null ;
751748 } ,
752749 findByChangeRequestUrl : ( url ) => parseChangeRequestUrl ( url ) ?. definition ,
753750 hostLabelForChangeRequestUrl : ( url ) =>
You can’t perform that action at this time.
0 commit comments