code: func (r *ChartRepository) DownloadIndexFile(cachePath string) error {
  	var indexURL string
  	parsedURL, err := url.Parse(r.Config.URL)
  	if err != nil {
  		return err
  	}
  	parsedURL.Path = strings.TrimSuffix(parsedURL.Path, "/") + "/index.yaml"
  
  	indexURL = parsedURL.String()
  
  	r.setCredentials()
  	resp, err := r.Client.Get(indexURL)
  	if err != nil {
  		return err
  	}
  
  	index, err := ioutil.ReadAll(resp)
  	if err != nil {
  		return err
  	}
  
  	if _, err := loadIndex(index); err != nil {
  		return err
  	}
  
  	// In Helm 2.2.0 the config.cache was accidentally switched to an absolute
  	// path, which broke backward compatibility. This fixes it by prepending a
  	// global cache path to relative paths.
  	//
  	// It is changed on DownloadIndexFile because that was the method that
  	// originally carried the cache path.
  	cp := r.Config.Cache
  	if !filepath.IsAbs(cp) {
  		cp = filepath.Join(cachePath, cp)
  	}
  
  	return ioutil.WriteFile(cp, index, 0644)
  }
docs: // DownloadIndexFile fetches the index from a repository.
  //
  // cachePath is prepended to any index that does not have an absolute path. This
  // is for pre-2.2.0 repo files.