From 1c4214f0d145f3eeae08586648c835da74cc46a1 Mon Sep 17 00:00:00 2001 From: Grant Linville Date: Wed, 15 May 2024 22:45:04 -0400 Subject: [PATCH 1/2] chore: change sys.download to use the workspace by default Signed-off-by: Grant Linville --- pkg/builtin/builtin.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/pkg/builtin/builtin.go b/pkg/builtin/builtin.go index 819f6f20..69487a28 100644 --- a/pkg/builtin/builtin.go +++ b/pkg/builtin/builtin.go @@ -162,7 +162,7 @@ var tools = map[string]types.Tool{ Description: "Downloads a URL, saving the contents to disk at a given location", Arguments: types.ObjectSchema( "url", "The URL to download, either http or https.", - "location", "(optional) The on disk location to store the file. If no location is specified a temp location will be used. If the target file already exists it will fail unless override is set to true.", + "location", "(optional) The on disk location to store the file. If no location is specified, the workspace will be used. If the target file already exists, it will fail unless override is set to true.", "override", "If true and a file at the location exists, the file will be overwritten, otherwise fail. Default is false"), }, BuiltinFunc: SysDownload, @@ -717,7 +717,10 @@ func SysDownload(ctx context.Context, env []string, input string) (_ string, err } checkExists := true - tmpDir := "" + tmpDir, err := getWorkspaceDir(env) + if err != nil { + return "", err + } if params.Location != "" { if s, err := os.Stat(params.Location); err == nil && s.IsDir() { From 6bb82a83a41052753e32c51d124e8357c6cfea84 Mon Sep 17 00:00:00 2001 From: Grant Linville Date: Thu, 16 May 2024 09:00:52 -0400 Subject: [PATCH 2/2] PR feedback Signed-off-by: Grant Linville --- pkg/builtin/builtin.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/builtin/builtin.go b/pkg/builtin/builtin.go index 69487a28..237f6bee 100644 --- a/pkg/builtin/builtin.go +++ b/pkg/builtin/builtin.go @@ -162,7 +162,7 @@ var tools = map[string]types.Tool{ Description: "Downloads a URL, saving the contents to disk at a given location", Arguments: types.ObjectSchema( "url", "The URL to download, either http or https.", - "location", "(optional) The on disk location to store the file. If no location is specified, the workspace will be used. If the target file already exists, it will fail unless override is set to true.", + "location", "(optional) The on disk location to store the file. If no location is specified a temp location will be used. If the target file already exists it will fail unless override is set to true.", "override", "If true and a file at the location exists, the file will be overwritten, otherwise fail. Default is false"), }, BuiltinFunc: SysDownload,