fix: preserve subpath base URLs in getHelmDownloadURL (#292)

Ensure downloadBaseURL ends with '/' before URL resolution so a subpath
mirror (e.g. https://example/kubernetes/helm) is preserved instead of having
its last path segment replaced. Fixes downloads for all subpath mirrors.
This commit is contained in:
Ogheneobukome Ejaife
2026-07-15 12:45:05 -07:00
committed by GitHub
parent 017211e1b1
commit eb399fcd4f
2 changed files with 33 additions and 1 deletions
+28
View File
@@ -140,6 +140,34 @@ describe('run.ts', () => {
expect(os.platform).toHaveBeenCalled()
})
test('getHelmDownloadURL() - preserve a subpath base URL without a trailing slash', () => {
vi.mocked(os.platform).mockReturnValue('linux')
vi.mocked(os.arch).mockReturnValue('x64')
const expected =
'https://mirror.example/kubernetes/helm/helm-v3.8.0-linux-amd64.tar.gz'
expect(
run.getHelmDownloadURL(
'https://mirror.example/kubernetes/helm',
'v3.8.0'
)
).toBe(expected)
})
test('getHelmDownloadURL() - preserve a subpath base URL with a trailing slash', () => {
vi.mocked(os.platform).mockReturnValue('linux')
vi.mocked(os.arch).mockReturnValue('x64')
const expected =
'https://mirror.example/kubernetes/helm/helm-v3.8.0-linux-amd64.tar.gz'
expect(
run.getHelmDownloadURL(
'https://mirror.example/kubernetes/helm/',
'v3.8.0'
)
).toBe(expected)
})
test('getLatestHelmVersion() - return the latest version of HELM', async () => {
const res = {
status: 200,