Skip to content

Commit

Permalink
Fix importing from HF repositories using the full URL
Browse files Browse the repository at this point in the history
  • Loading branch information
amisevsk committed Feb 12, 2025
1 parent fd7bbf8 commit 6b9d621
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion pkg/cmd/kitimport/hfimport.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ func importUsingHF(ctx context.Context, opts *importOptions) error {
if err != nil {
return err
}
if err := hf.DownloadFiles(ctx, opts.repo, tmpDir, toDownload, opts.token, opts.concurrency); err != nil {
if err := hf.DownloadFiles(ctx, repo, tmpDir, toDownload, opts.token, opts.concurrency); err != nil {
return fmt.Errorf("error downloading repository: %w", err)
}

Expand Down
3 changes: 2 additions & 1 deletion pkg/lib/hf/download.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ func downloadFile(
progress *output.DownloadProgressBar,
plog *output.ProgressLogger) error {

plog.Debugf("Downloading from %s", srcURL)
req, err := http.NewRequestWithContext(ctx, http.MethodGet, srcURL, nil)
if err != nil {
return fmt.Errorf("failed to resolve URL: %w", err)
Expand All @@ -106,7 +107,7 @@ func downloadFile(
}()

if resp.StatusCode != http.StatusOK {
return fmt.Errorf("received status code %d when downloading file %s to %s", resp.StatusCode, srcURL, destPath)
return fmt.Errorf("received status code %d when downloading file %s from %s", resp.StatusCode, filename, srcURL)
}

contentRC := progress.TrackDownload(resp.Body, filename, resp.ContentLength)
Expand Down

0 comments on commit 6b9d621

Please sign in to comment.