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)
This commit is contained in:
parent
bb4cc876b1
commit
d21702475b
4 changed files with 7 additions and 9 deletions
|
@ -621,7 +621,6 @@ func CompareDiff(ctx *context.Context) {
|
|||
headGitRepo.Close()
|
||||
}
|
||||
}()
|
||||
|
||||
if ctx.Written() {
|
||||
return
|
||||
}
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue