pass url to Download(), not constructor

This commit is contained in:
marco 2024-04-22 12:43:27 +02:00
parent aebf85613e
commit c07835fab3
3 changed files with 6 additions and 6 deletions

View file

@ -42,7 +42,7 @@ func downloadDataSet(dataFolder string, force bool, reader io.Reader, logger *lo
}
d := downloader.
New(dataS.SourceURL).
New().
WithHTTPClient(hubClient).
ToFile(destPath).
CompareContent().
@ -55,7 +55,7 @@ func downloadDataSet(dataFolder string, force bool, reader io.Reader, logger *lo
ctx := context.TODO()
downloaded, err := d.Download(ctx)
downloaded, err := d.Download(ctx, dataS.SourceURL)
if err != nil {
return fmt.Errorf("while getting data: %w", err)
}

View file

@ -121,7 +121,7 @@ func (i *Item) FetchContentTo(destPath string) (bool, string, error) {
}
d := downloader.
New(url).
New().
WithHTTPClient(hubClient).
ToFile(destPath).
WithMakeDirs(true).
@ -133,7 +133,7 @@ func (i *Item) FetchContentTo(destPath string) (bool, string, error) {
ctx := context.TODO()
downloaded, err := d.Download(ctx)
downloaded, err := d.Download(ctx, url)
if err != nil {
return false, "", fmt.Errorf("while downloading %s to %s: %w", i.Name, url, err)
}

View file

@ -44,12 +44,12 @@ func (r *RemoteHubCfg) fetchIndex(destPath string) (bool, error) {
ctx := context.TODO()
downloaded, err := downloader.
New(url).
New().
WithHTTPClient(hubClient).
ToFile(destPath).
CompareContent().
WithLogger(logrus.WithFields(logrus.Fields{"url": url})).
Download(ctx)
Download(ctx, url)
if err != nil {
return false, err
}