diff --git a/dist/index.js b/dist/index.js index fe3f317..6241dc1 100644 --- a/dist/index.js +++ b/dist/index.js @@ -167,13 +167,13 @@ class GitAuthHelper { this.settings = gitSourceSettings || {}; // Token auth header const serverUrl = urlHelper.getServerUrl(this.settings.githubServerUrl); - this.tokenConfigKey = `http.${serverUrl.origin}/.extraheader`; // "origin" is SCHEME://HOSTNAME[:PORT] + this.tokenConfigKey = `http.${serverUrl.origin}${serverUrl.pathname}/.extraheader`; // "origin" is SCHEME://HOSTNAME[:PORT] const basicCredential = Buffer.from(`x-access-token:${this.settings.authToken}`, 'utf8').toString('base64'); core.setSecret(basicCredential); this.tokenPlaceholderConfigValue = `AUTHORIZATION: basic ***`; this.tokenConfigValue = `AUTHORIZATION: basic ${basicCredential}`; // Instead of SSH URL - this.insteadOfKey = `url.${serverUrl.origin}/.insteadOf`; // "origin" is SCHEME://HOSTNAME[:PORT] + this.insteadOfKey = `url.${serverUrl.origin}${serverUrl.pathname}/.insteadOf`; // "origin" is SCHEME://HOSTNAME[:PORT] this.insteadOfValues.push(`git@${serverUrl.hostname}:`); if (this.settings.workflowOrganizationId) { this.insteadOfValues.push(`org-${this.settings.workflowOrganizationId}@github.com:`); @@ -2731,7 +2731,7 @@ function getFetchUrl(settings) { return `${user}@${serviceUrl.hostname}:${encodedOwner}/${encodedName}.git`; } // "origin" is SCHEME://HOSTNAME[:PORT] - return `${serviceUrl.origin}/${encodedOwner}/${encodedName}`; + return `${serviceUrl.origin}${serviceUrl.pathname}/${encodedOwner}/${encodedName}`; } function getServerUrl(url) { let resolvedUrl = process.env['GITHUB_SERVER_URL'] || 'https://github.com'; @@ -38511,4 +38511,4 @@ module.exports = parseParams /******/ module.exports = __webpack_exports__; /******/ /******/ })() -; \ No newline at end of file +; diff --git a/src/git-auth-helper.ts b/src/git-auth-helper.ts index e67db14..e95ab7e 100644 --- a/src/git-auth-helper.ts +++ b/src/git-auth-helper.ts @@ -54,7 +54,7 @@ class GitAuthHelper { // Token auth header const serverUrl = urlHelper.getServerUrl(this.settings.githubServerUrl) - this.tokenConfigKey = `http.${serverUrl.origin}/.extraheader` // "origin" is SCHEME://HOSTNAME[:PORT] + this.tokenConfigKey = `http.${serverUrl.origin}${serverUrl.pathname}/.extraheader` // "origin" is SCHEME://HOSTNAME[:PORT] const basicCredential = Buffer.from( `x-access-token:${this.settings.authToken}`, 'utf8' @@ -64,7 +64,7 @@ class GitAuthHelper { this.tokenConfigValue = `AUTHORIZATION: basic ${basicCredential}` // Instead of SSH URL - this.insteadOfKey = `url.${serverUrl.origin}/.insteadOf` // "origin" is SCHEME://HOSTNAME[:PORT] + this.insteadOfKey = `url.${serverUrl.origin}${serverUrl.pathname}/.insteadOf` // "origin" is SCHEME://HOSTNAME[:PORT] this.insteadOfValues.push(`git@${serverUrl.hostname}:`) if (this.settings.workflowOrganizationId) { this.insteadOfValues.push( diff --git a/src/url-helper.ts b/src/url-helper.ts index 17a0842..4753693 100644 --- a/src/url-helper.ts +++ b/src/url-helper.ts @@ -17,7 +17,7 @@ export function getFetchUrl(settings: IGitSourceSettings): string { } // "origin" is SCHEME://HOSTNAME[:PORT] - return `${serviceUrl.origin}/${encodedOwner}/${encodedName}` + return `${serviceUrl.origin}${serviceUrl.pathname}/${encodedOwner}/${encodedName}` } export function getServerUrl(url?: string): URL {