diff --git a/app/repo-download.go b/app/repo-download.go index d59bff9..499c331 100644 --- a/app/repo-download.go +++ b/app/repo-download.go @@ -1,13 +1,11 @@ package app import ( - "context" md "farga/app/middleware" "farga/db/types" "farga/lib/git" "fmt" "net/http" - "time" "github.com/gorilla/mux" ) @@ -30,9 +28,6 @@ func (a *App) RepoZipDownload(w http.ResponseWriter, r *http.Request) { repoPath := git.RepoPath(*dbRepo.UserID, dbRepo.ID) - ctx, cancel := context.WithTimeout(r.Context(), 30*time.Second) - defer cancel() - // don't waste resources if the reference is invalid. ref, err := git.ResolveHead(gitRepo.Git, branch) if err != nil { @@ -42,7 +37,7 @@ func (a *App) RepoZipDownload(w http.ResponseWriter, r *http.Request) { w.Header().Set("Content-Disposition", fmt.Sprintf("attachment; filename=\"%s-%s.zip\"", dbRepo.Name, ref.Name().Short())) // name the file - err = git.ZipStream(ctx, repoPath, ref.Hash().String(), w) + err = git.ZipStream(r.Context(), repoPath, ref.Hash().String(), w) if err != nil { http.Error(w, err.Error(), http.StatusBadRequest) return