Skip to content
Snippets Groups Projects
Unverified Commit ec441180 authored by lfcyja's avatar lfcyja Committed by GitHub
Browse files

fix(datasource): re-encode URL to support white spaces in Azure projects (#23354)

parent 43551e56
No related merge requests found
[submodule "some-azure"]
path = some-azure
url = https://organization@dev.azure.com/organization/whitespace%20project/_git/repo
...@@ -164,5 +164,29 @@ describe('modules/manager/git-submodules/extract', () => { ...@@ -164,5 +164,29 @@ describe('modules/manager/git-submodules/extract', () => {
], ],
}); });
}); });
it('whitespaces in submodule URL are encoded properly', async () => {
hostRules.add({
matchHost: 'organization@dev.azure.com/organization',
token: 'pat',
hostType: 'azure',
});
gitMock.listRemote.mockResolvedValueOnce(
'ref: refs/heads/main HEAD\n5701164b9f5edba1f6ca114c491a564ffb55a964 HEAD'
);
const res = await extractPackageFile('', '.gitmodules.6', {});
expect(res).toEqual({
datasource: 'git-refs',
deps: [
{
currentDigest: '4b825dc642cb6eb9a060e54bf8d69288fbee4904',
currentValue: 'main',
depName: 'some-azure',
packageName:
'https://organization@dev.azure.com/organization/whitespace%20project/_git/repo',
},
],
});
});
}); });
}); });
...@@ -32,7 +32,7 @@ export function getHttpUrl(url: string, token?: string): string { ...@@ -32,7 +32,7 @@ export function getHttpUrl(url: string, token?: string): string {
} }
} }
return parsedUrl.toString(protocol); return new URL(parsedUrl.toString(protocol)).href;
} }
export function getRemoteUrlWithToken(url: string, hostType?: string): string { export function getRemoteUrlWithToken(url: string, hostType?: string): string {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment