mirror of
https://github.com/renovatebot/renovate.git
synced 2025-01-12 06:56:24 +00:00
fix(bitbucket-server): revert encode auth in URL (#3511)
This reverts commit 3e66e019e4
.
This commit is contained in:
parent
107051e7cd
commit
ec16c8b2b8
2 changed files with 3 additions and 19 deletions
|
@ -124,9 +124,7 @@ async function initRepo({
|
||||||
const { host, pathname } = url.parse(opts.endpoint);
|
const { host, pathname } = url.parse(opts.endpoint);
|
||||||
const gitUrl = GitStorage.getUrl({
|
const gitUrl = GitStorage.getUrl({
|
||||||
gitFs: gitFs || 'https',
|
gitFs: gitFs || 'https',
|
||||||
auth: `${encodeURIComponent(opts.username)}:${encodeURIComponent(
|
auth: `${opts.username}:${opts.password}`,
|
||||||
opts.password
|
|
||||||
)}`,
|
|
||||||
host: `${host}${pathname}${pathname.endsWith('/') ? '' : '/'}scm`,
|
host: `${host}${pathname}${pathname.endsWith('/') ? '' : '/'}scm`,
|
||||||
repository,
|
repository,
|
||||||
});
|
});
|
||||||
|
|
|
@ -33,7 +33,6 @@ describe('platform/bitbucket-server', () => {
|
||||||
jest.spyOn(api, 'delete');
|
jest.spyOn(api, 'delete');
|
||||||
bitbucket = require('../../../lib/platform/bitbucket-server');
|
bitbucket = require('../../../lib/platform/bitbucket-server');
|
||||||
GitStorage = require('../../../lib/platform/git/storage');
|
GitStorage = require('../../../lib/platform/git/storage');
|
||||||
jest.spyOn(GitStorage, 'getUrl');
|
|
||||||
GitStorage.mockImplementation(() => ({
|
GitStorage.mockImplementation(() => ({
|
||||||
initRepo: jest.fn(),
|
initRepo: jest.fn(),
|
||||||
cleanRepo: jest.fn(),
|
cleanRepo: jest.fn(),
|
||||||
|
@ -59,8 +58,8 @@ describe('platform/bitbucket-server', () => {
|
||||||
hostRules.update({
|
hostRules.update({
|
||||||
platform: 'bitbucket-server',
|
platform: 'bitbucket-server',
|
||||||
token: 'token',
|
token: 'token',
|
||||||
username: 'user@ame',
|
username: 'username',
|
||||||
password: 'passw:rd',
|
password: 'password',
|
||||||
endpoint: mockResponses.baseURL,
|
endpoint: mockResponses.baseURL,
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -99,19 +98,6 @@ describe('platform/bitbucket-server', () => {
|
||||||
expect(res).toMatchSnapshot();
|
expect(res).toMatchSnapshot();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('sends the username and password encoded', async () => {
|
|
||||||
expect.assertions(2);
|
|
||||||
GitStorage.getUrl.mockClear();
|
|
||||||
await bitbucket.initRepo({
|
|
||||||
repository: 'SOME/repo',
|
|
||||||
});
|
|
||||||
expect(GitStorage.getUrl).toHaveBeenCalledTimes(1);
|
|
||||||
expect(GitStorage.getUrl.mock.calls[0][0]).toHaveProperty(
|
|
||||||
'auth',
|
|
||||||
'user%40ame:passw%3Ard'
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('sends the host as the endpoint option', async () => {
|
it('sends the host as the endpoint option', async () => {
|
||||||
expect.assertions(2);
|
expect.assertions(2);
|
||||||
GitStorage.getUrl.mockClear();
|
GitStorage.getUrl.mockClear();
|
||||||
|
|
Loading…
Reference in a new issue