Skip to content

Commit 418a1fa

Browse files
committed
fix getCloneUrl for BBS
1 parent a3ecb47 commit 418a1fa

File tree

1 file changed

+19
-2
lines changed

1 file changed

+19
-2
lines changed

components/server/src/prebuilds/bitbucket-server-app.ts

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ export class BitbucketServerApp {
126126
span.setTag("contextUrl", contextUrl);
127127
const context = await this.contextParser.handle({ span }, user, contextUrl);
128128
if (!CommitContext.is(context)) {
129-
throw new Error("CommitContext exprected.");
129+
throw new Error("CommitContext expected.");
130130
}
131131
const commit = context.revision;
132132
await this.webhookEvents.updateEvent(event.id, {
@@ -240,7 +240,24 @@ export class BitbucketServerApp {
240240
}
241241

242242
protected getCloneUrl(event: PushEventPayload): string {
243-
return event.repository.links.clone[0].href;
243+
// "links": {
244+
// "clone": [
245+
// {
246+
// "href": "ssh://[email protected]:7999/tes/hello-world-zz-1.git",
247+
// "name": "ssh"
248+
// },
249+
// {
250+
// "href": "https://bitbucket.gitpod-dev.com/scm/tes/hello-world-zz-1.git",
251+
// "name": "http"
252+
// }
253+
// ],
254+
// "self": [...]
255+
// }
256+
const cloneURL = event.repository?.links?.clone?.find((link) => link?.name === "http")?.href;
257+
if (!cloneURL) {
258+
throw new Error(`Expected to read clone URL from push event. Repository: ${event?.repository?.name}`);
259+
}
260+
return cloneURL;
244261
}
245262

246263
get router(): express.Router {

0 commit comments

Comments
 (0)