diff options
Diffstat (limited to 'modules/context/repo.go')
-rw-r--r-- | modules/context/repo.go | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/modules/context/repo.go b/modules/context/repo.go index c1f60a1362..3e48b34b3d 100644 --- a/modules/context/repo.go +++ b/modules/context/repo.go @@ -905,12 +905,18 @@ func (ctx *Context) IssueTemplatesFromDefaultBranch() []api.IssueTemplate { log.Debug("DataAsync: %v", err) continue } - defer r.Close() + closed := false + defer func() { + if !closed { + _ = r.Close() + } + }() data, err := ioutil.ReadAll(r) if err != nil { log.Debug("ReadAll: %v", err) continue } + _ = r.Close() var it api.IssueTemplate content, err := markdown.ExtractMetadata(string(data), &it) if err != nil { |