summaryrefslogtreecommitdiffstats
path: root/routers/web
diff options
context:
space:
mode:
author6543 <6543@obermui.de>2021-08-31 09:43:31 +0200
committerGitHub <noreply@github.com>2021-08-31 08:43:31 +0100
commitd21702475ba43100d3a6e9505a1ae259e4842524 (patch)
treea9163f924f3a0eedda389a557759854312a8b9f0 /routers/web
parentbb4cc876b1d0d5be5aa3fed7827ba3eac8f2ac18 (diff)
downloadgitea-d21702475ba43100d3a6e9505a1ae259e4842524.tar.gz
gitea-d21702475ba43100d3a6e9505a1ae259e4842524.zip
Fix git.Blob.DataAsync(): close pipe since we return a NopCloser (#16899)
* make sure headGitRepo is closed on err too * refactor * Fix git.Blob.DataAsync(): exec cancel since we already read all bytes (close pipe since we return a NopCloser)
Diffstat (limited to 'routers/web')
-rw-r--r--routers/web/repo/compare.go1
-rw-r--r--routers/web/repo/issue.go3
-rw-r--r--routers/web/repo/pull.go6
3 files changed, 5 insertions, 5 deletions
diff --git a/routers/web/repo/compare.go b/routers/web/repo/compare.go
index ee8d376612..eb6c37a1a6 100644
--- a/routers/web/repo/compare.go
+++ b/routers/web/repo/compare.go
@@ -621,7 +621,6 @@ func CompareDiff(ctx *context.Context) {
headGitRepo.Close()
}
}()
-
if ctx.Written() {
return
}
diff --git a/routers/web/repo/issue.go b/routers/web/repo/issue.go
index 3f7af7a51f..bb3a0c8a9c 100644
--- a/routers/web/repo/issue.go
+++ b/routers/web/repo/issue.go
@@ -419,9 +419,6 @@ func RetrieveRepoMilestonesAndAssignees(ctx *context.Context, repo *models.Repos
}
handleTeamMentions(ctx)
- if ctx.Written() {
- return
- }
}
func retrieveProjects(ctx *context.Context, repo *models.Repository) {
diff --git a/routers/web/repo/pull.go b/routers/web/repo/pull.go
index 6e83a72c24..8ff2ddf394 100644
--- a/routers/web/repo/pull.go
+++ b/routers/web/repo/pull.go
@@ -1024,10 +1024,14 @@ func CompareAndPullRequestPost(ctx *context.Context) {
)
headUser, headRepo, headGitRepo, prInfo, baseBranch, headBranch := ParseCompareInfo(ctx)
+ defer func() {
+ if headGitRepo != nil {
+ headGitRepo.Close()
+ }
+ }()
if ctx.Written() {
return
}
- defer headGitRepo.Close()
labelIDs, assigneeIDs, milestoneID, _ := ValidateRepoMetas(ctx, *form, true)
if ctx.Written() {