Skip to content

Commit

Permalink
fix(gomod): remove token encoding (#12352)
Browse files Browse the repository at this point in the history
Co-authored-by: Rhys Arkins <rhys@arkins.net>
  • Loading branch information
Shegox and rarkins committed Oct 27, 2021
1 parent 91f067b commit 53964d1
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
7 changes: 4 additions & 3 deletions lib/util/git/auth.spec.ts
Expand Up @@ -18,14 +18,15 @@ describe('util/git/auth', () => {
});
});

it('returns url with correctly encoded token', () => {
it('returns correct url if token already contains GitHub App username', () => {
expect(
getGitAuthenticatedEnvironmentVariables(
'https://github.com/',
'token:1234'
'x-access-token:token1234'
)
).toStrictEqual({
GIT_CONFIG_KEY_0: 'url.https://token%3A1234@github.com/.insteadOf',
GIT_CONFIG_KEY_0:
'url.https://x-access-token:token1234@github.com/.insteadOf',
GIT_CONFIG_VALUE_0: 'https://github.com/',
GIT_CONFIG_COUNT: '1',
});
Expand Down
2 changes: 1 addition & 1 deletion lib/util/git/auth.ts
Expand Up @@ -24,7 +24,7 @@ export function getGitAuthenticatedEnvironmentVariables(
}
}

const gitUrlWithToken = getHttpUrl(gitUrl, encodeURIComponent(token));
const gitUrlWithToken = getHttpUrl(gitUrl, token);

// create a shallow copy of the environmentVariables as base so we don't modify the input parameter object
// add the two new config key and value to the returnEnvironmentVariables object
Expand Down

0 comments on commit 53964d1

Please sign in to comment.