Skip to content

Commit ed2a62e

Browse files
author
Jagger De Leo
committed
fix: handle slashes in branch names
1 parent 1b0834c commit ed2a62e

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

e2/templater/templates.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ func ExecTmplDir(cwd, name, templatesPath, tmplName string, templateData interfa
206206

207207
// downloadZip downloads a ZIP from a particular branch of the repo.
208208
func downloadZip(repo, branch, targetPath string) (string, error) {
209-
// If downloading from a tag, use full v0.0.0 format.
209+
// If downloading from a tag, use full v0.0.0 format, do not normalize.
210210
url := fmt.Sprintf("https://github.com/%s/archive/%s.zip", repo, branch)
211211

212212
req, err := http.NewRequest(http.MethodGet, url, nil)
@@ -223,7 +223,7 @@ func downloadZip(repo, branch, targetPath string) (string, error) {
223223
return "", fmt.Errorf("response was non-200: %d", resp.StatusCode)
224224
}
225225

226-
filepathVar := filepath.Join(targetPath, fmt.Sprintf("e2core-%s.zip", normalizeBranch(branch)))
226+
filepathVar := filepath.Join(targetPath, fmt.Sprintf("e2core-%s.zip", strings.ReplaceAll(normalizeBranch(branch), "/", "-")))
227227

228228
// Check if the zip already exists, and delete it if it does.
229229
if _, err := os.Stat(filepathVar); err == nil {

0 commit comments

Comments
 (0)