Skip to content

Commit b97e14e

Browse files
authored
Ensure that cache dir exists before downloading ZIP archive (#352)
* Ensure that cache dir exists before downloading ZIP archive * Add PR number
1 parent a177c83 commit b97e14e

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ All notable changes to `src-cli` are documented in this file.
1717

1818
### Fixed
1919

20+
- The cache dir used by `src campaign [preview|apply]` is now created before trying to create files in it, fixing a bug where the first run of the command could fail with a "file doesn't exist" error message. [#352](https://github.com/sourcegraph/src-cli/pull/352)
21+
2022
## 3.21.1
2123

2224
### Added

internal/campaigns/archive_fetcher.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,10 @@ func fetchRepositoryArchive(ctx context.Context, client api.Client, repo *graphq
8686
return fmt.Errorf("unable to fetch archive (HTTP %d from %s)", resp.StatusCode, req.URL.String())
8787
}
8888

89+
if err := os.MkdirAll(filepath.Dir(dest), 0700); err != nil {
90+
return err
91+
}
92+
8993
f, err := os.Create(dest)
9094
if err != nil {
9195
return err

0 commit comments

Comments
 (0)