From a920781ca9ff07aec4d7c339072c06960c5d2a8b Mon Sep 17 00:00:00 2001 From: Rob Herley Date: Mon, 20 Nov 2023 18:06:44 +0000 Subject: [PATCH] fix results url construction --- .../artifact/src/internal/shared/artifact-twirp-client.ts | 4 ++-- packages/artifact/src/internal/shared/config.ts | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/packages/artifact/src/internal/shared/artifact-twirp-client.ts b/packages/artifact/src/internal/shared/artifact-twirp-client.ts index 444e3fac..09355808 100644 --- a/packages/artifact/src/internal/shared/artifact-twirp-client.ts +++ b/packages/artifact/src/internal/shared/artifact-twirp-client.ts @@ -52,8 +52,8 @@ class ArtifactHttpClient implements Rpc { contentType: 'application/json' | 'application/protobuf', data: object | Uint8Array ): Promise { - const url = `${this.baseUrl}/twirp/${service}/${method}` - debug(`Requesting ${url}`) + const url = new URL(`/twirp/${service}/${method}`, this.baseUrl).href + debug(`Requesting: ${url}`) const headers = { 'Content-Type': contentType } diff --git a/packages/artifact/src/internal/shared/config.ts b/packages/artifact/src/internal/shared/config.ts index eb122207..a5631bfc 100644 --- a/packages/artifact/src/internal/shared/config.ts +++ b/packages/artifact/src/internal/shared/config.ts @@ -19,7 +19,8 @@ export function getResultsServiceUrl(): string { if (!resultsUrl) { throw new Error('Unable to get the ACTIONS_RESULTS_URL env variable') } - return resultsUrl + + return new URL(resultsUrl).origin } export function isGhes(): boolean {