@@ -97,7 +97,8 @@ import * as PullRequestReadCache from "./PullRequestReadCache.ts";
9797import * as PullRequestProviderRegistry from "./PullRequestProviderRegistry.ts" ;
9898import * as ViewedFiles from "./pullRequestViewedFiles.ts" ;
9999
100- type WithWebUrl < I > = I & Pick < ProviderRepositoryRef , "webUrl" > ;
100+ // Null keeps raw API selectors from inheriting an HTTP checkout's URL.
101+ type WithWebUrl < I > = I & { readonly webUrl ?: string | null | undefined } ;
101102export type PullRequestRef = WithWebUrl < ContractPullRequestRef > ;
102103
103104export interface PullRequestMergeEvent extends PullRequestRef {
@@ -314,7 +315,7 @@ export interface SupportedProject {
314315 readonly api : PullRequestProviderApi ;
315316 readonly repository : string ;
316317 readonly host : string ;
317- readonly webUrl ?: string | undefined ;
318+ readonly webUrl ?: string | null | undefined ;
318319 /**
319320 * Unique where `repository` is not: Azure's is a bare name that repeats across an organisation.
320321 */
@@ -334,7 +335,7 @@ const providerRef = (project: SupportedProject): ProviderRepositoryRef => ({
334335 cwd : project . project . workspaceRoot ,
335336 repository : project . repository ,
336337 host : project . host ,
337- ...( project . webUrl === undefined ? { } : { webUrl : project . webUrl } ) ,
338+ ...( project . webUrl == null ? { } : { webUrl : project . webUrl } ) ,
338339} ) ;
339340
340341interface WorkspaceProjects {
@@ -804,7 +805,9 @@ export const make = Effect.gen(function* () {
804805 if ( host === undefined || host === own . host )
805806 return Effect . succeed ( {
806807 ...own ,
807- ...( ref . webUrl === undefined ? { } : { webUrl : withoutUrlCredentials ( ref . webUrl ) } ) ,
808+ ...( ref . webUrl === undefined
809+ ? { }
810+ : { webUrl : ref . webUrl === null ? null : withoutUrlCredentials ( ref . webUrl ) } ) ,
808811 } ) ;
809812 }
810813 if ( host === undefined ) {
@@ -863,7 +866,9 @@ export const make = Effect.gen(function* () {
863866 host,
864867 ...( ref . webUrl === undefined
865868 ? { }
866- : { webUrl : withoutUrlCredentials ( ref . webUrl ) } ) ,
869+ : {
870+ webUrl : ref . webUrl === null ? null : withoutUrlCredentials ( ref . webUrl ) ,
871+ } ) ,
867872 remote : normalizeGitRemoteUrl ( `https://${ host } /${ repository } ` ) ,
868873 repositoryKey : null ,
869874 } ;
@@ -883,7 +888,9 @@ export const make = Effect.gen(function* () {
883888 ? sameRepository
884889 ? route . webUrl
885890 : undefined
886- : withoutUrlCredentials ( ref . webUrl ) ,
891+ : ref . webUrl === null
892+ ? null
893+ : withoutUrlCredentials ( ref . webUrl ) ,
887894 remote : sameRepository
888895 ? route . remote
889896 : normalizeGitRemoteUrl ( `https://${ host } /${ repository } ` ) ,
@@ -2562,10 +2569,10 @@ export const make = Effect.gen(function* () {
25622569 ref . number ,
25632570 ref . expectedAccountId ?? null ,
25642571 ref [ credentialNamespace ] ?? null ,
2565- ref . webUrl ?? null ,
2572+ { webUrl : ref . webUrl } ,
25662573 ] ) ;
25672574 const refOfCacheKey = ( key : string ) : PullRequestRef => {
2568- const [ , projectId , host , repository , number , expectedAccountId , fingerprint , webUrl ] =
2575+ const [ , projectId , host , repository , number , expectedAccountId , fingerprint , urlReference ] =
25692576 JSON . parse ( key ) as [
25702577 number ,
25712578 string ,
@@ -2574,14 +2581,14 @@ export const make = Effect.gen(function* () {
25742581 number ,
25752582 string | null ,
25762583 string | null ,
2577- string | null ,
2584+ Pick < PullRequestRef , "webUrl" > ,
25782585 ] ;
25792586 return {
25802587 projectId,
25812588 ...( host === null ? { } : { host } ) ,
25822589 ...( expectedAccountId === null ? { } : { expectedAccountId } ) ,
25832590 ...( fingerprint === null ? { } : { [ credentialNamespace ] : fingerprint } ) ,
2584- ...( webUrl === null ? { } : { webUrl } ) ,
2591+ ...urlReference ,
25852592 repository,
25862593 number,
25872594 } as PullRequestRef ;
0 commit comments