@@ -29,7 +29,6 @@ import (
29
29
"os"
30
30
"path"
31
31
"sort"
32
- "strings"
33
32
"sync"
34
33
"time"
35
34
@@ -261,30 +260,16 @@ func (r *ChartRepository) DownloadChart(chart *repo.ChartVersion) (*bytes.Buffer
261
260
// always the correct one to pick, check for updates once in awhile.
262
261
// Ref: https://github.com/helm/helm/blob/v3.3.0/pkg/downloader/chart_downloader.go#L241
263
262
ref := chart .URLs [0 ]
264
- u , err := url . Parse ( ref )
263
+ resolvedUrl , err := repo . ResolveReferenceURL ( r . URL , ref )
265
264
if err != nil {
266
- err = fmt .Errorf ("invalid chart URL format '%s': %w" , ref , err )
267
265
return nil , err
268
266
}
269
267
270
- // Prepend the chart repository base URL if the URL is relative
271
- if ! u .IsAbs () {
272
- repoURL , err := url .Parse (r .URL )
273
- if err != nil {
274
- err = fmt .Errorf ("invalid chart repository URL format '%s': %w" , r .URL , err )
275
- return nil , err
276
- }
277
- // Trailing slash is required for ResolveReference to work
278
- repoURL .Path = strings .TrimSuffix (repoURL .Path , "/" ) + "/"
279
- u = repoURL .ResolveReference (u )
280
- u .RawQuery = repoURL .RawQuery
281
- }
282
-
283
268
t := transport .NewOrIdle (r .tlsConfig )
284
269
clientOpts := append (r .Options , getter .WithTransport (t ))
285
270
defer transport .Release (t )
286
271
287
- return r .Client .Get (u . String () , clientOpts ... )
272
+ return r .Client .Get (resolvedUrl , clientOpts ... )
288
273
}
289
274
290
275
// LoadIndexFromBytes loads Index from the given bytes.
0 commit comments