diff options
author | zeripath <art27@cantab.net> | 2021-09-18 01:54:15 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-09-17 20:54:15 -0400 |
commit | 25533657f6a3edd2d12c8b8112d009559a136201 (patch) | |
tree | bdab2bd70e3fb4156728f2e81bfc5dfdc2a46c38 /routers | |
parent | 693bea9780be8c9ecc40bc751e6fafbeaea07743 (diff) | |
download | gitea-25533657f6a3edd2d12c8b8112d009559a136201.tar.gz gitea-25533657f6a3edd2d12c8b8112d009559a136201.zip |
Add caller to cat-file batch calls (#17082)
Some people still appear to report unclosed cat-files. This PR simply adds the caller
to the process descriptor for the CatFileBatch and CatFileBatchCheck calls.
Signed-off-by: Andrew Thornton <art27@cantab.net>
Co-authored-by: techknowlogick <techknowlogick@gitea.io>
Diffstat (limited to 'routers')
-rw-r--r-- | routers/api/v1/repo/file.go | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/routers/api/v1/repo/file.go b/routers/api/v1/repo/file.go index 2b14d1a93c..d9451b8090 100644 --- a/routers/api/v1/repo/file.go +++ b/routers/api/v1/repo/file.go @@ -119,13 +119,15 @@ func GetArchive(ctx *context.APIContext) { // "$ref": "#/responses/notFound" repoPath := models.RepoPath(ctx.Params(":username"), ctx.Params(":reponame")) - gitRepo, err := git.OpenRepository(repoPath) - if err != nil { - ctx.Error(http.StatusInternalServerError, "OpenRepository", err) - return + if ctx.Repo.GitRepo == nil { + gitRepo, err := git.OpenRepository(repoPath) + if err != nil { + ctx.Error(http.StatusInternalServerError, "OpenRepository", err) + return + } + ctx.Repo.GitRepo = gitRepo + defer gitRepo.Close() } - ctx.Repo.GitRepo = gitRepo - defer gitRepo.Close() repo.Download(ctx.Context) } |