mirror of
https://github.com/Azure/setup-helm.git
synced 2026-08-03 17:04:25 +00:00
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:
committed by
GitHub
parent
017211e1b1
commit
eb399fcd4f
+5
-1
@@ -139,7 +139,11 @@ export function getExecutableExtension(): string {
|
||||
|
||||
export function getHelmDownloadURL(baseURL: string, version: string): string {
|
||||
const urlPath = `helm-${version}-${getPlatform()}-${getArch()}.${getArchiveExtension()}`
|
||||
const url = new URL(urlPath, baseURL)
|
||||
// Ensure the base ends with '/' so a subpath mirror (e.g.
|
||||
// 'https://example/kubernetes/helm') is preserved; otherwise URL resolution
|
||||
// replaces the last path segment and points at the wrong location.
|
||||
const base = baseURL.endsWith('/') ? baseURL : `${baseURL}/`
|
||||
const url = new URL(urlPath, base)
|
||||
return url.toString()
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user