From d4a4c74c9c266ec99330107a8044ed1065502fe7 Mon Sep 17 00:00:00 2001 From: Muhammad Uzair Seyal <37130007+777Denoiser@users.noreply.github.com> Date: Wed, 4 Dec 2024 01:22:32 -0500 Subject: [PATCH] Update resource.go deleted my code under the geturltodir function and added the missing line that was requested --- internal/resource.go | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) diff --git a/internal/resource.go b/internal/resource.go index c5829c5..a3b1c58 100644 --- a/internal/resource.go +++ b/internal/resource.go @@ -69,20 +69,7 @@ func GetUrlToDir(u string, targetDir string, ctx context.Context) (string, error h := sha256.New() h.Write([]byte(u)) fileName := filepath.Join(targetDir, fmt.Sprintf(".%s", hex.EncodeToString(h.Sum(nil)))) - - // Create new file with immediate close - file, err := os.Create(fileName) - if err != nil { - return "", fmt.Errorf("failed to create file: %v", err) - } - file.Close() - - fileName, err = getUrl(u, fileName, ctx) - if err != nil { - return "", err - } - - return fileName, nil + return getUrl(u, filename, ctx) } // GetUrlWithDir downloads the given resource to a temporary file and returns the path to it.