From 0497bb65950cbba5d8c207743a79c1188ad47ca9 Mon Sep 17 00:00:00 2001 From: Tai An Date: Wed, 6 May 2026 12:59:09 -0700 Subject: [PATCH] fix(downloader): list supported URL schemes in DownloadFile error (#9689) * fix(downloader): list supported URL schemes when input is unrecognized The error message previously read "does not look like an HTTP URL", but the downloader actually supports file://, huggingface://, hf://, ollama://, oci://, and github:// in addition to http(s)://. Users who type a bare filename or a typo'd scheme (e.g. fle:// instead of file://) get the misleading impression that only HTTP is accepted. Reference the existing prefix constants directly via strings.Join so the scheme list cannot drift when new prefixes are added. Refs #9683. Signed-off-by: Tai An * fix(downloader): normalize uri.go to LF line endings Resolves the noisy diff and golangci-lint errcheck warnings on lines I did not actually modify. * fix(downloader): preserve trailing newline at end of file --------- Signed-off-by: Tai An --- pkg/downloader/uri.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/downloader/uri.go b/pkg/downloader/uri.go index 044d5d611..09023f3e2 100644 --- a/pkg/downloader/uri.go +++ b/pkg/downloader/uri.go @@ -467,7 +467,7 @@ func (uri URI) DownloadFileWithContext(ctx context.Context, filePath, sha string } } else if !os.IsNotExist(err) || !URI(url).LooksLikeHTTPURL() { // Error occurred while checking file existence - return fmt.Errorf("file %s does not exist (%v) and %s does not look like an HTTP URL", filePath, err, url) + return fmt.Errorf("could not fetch %q: local file does not exist (%v) and %q is not a recognized downloadable URL (supported schemes: %s)", filePath, err, url, strings.Join([]string{HTTPPrefix, HTTPSPrefix, LocalPrefix, HuggingFacePrefix, HuggingFacePrefix1, OllamaPrefix, OCIPrefix, OCIFilePrefix, GithubURI2}, ", ")) } xlog.Info("Downloading", "url", url)