mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2024-11-25 08:59:31 -05:00
Ignore useless error message "broken pipe" (#30801)
Fix #30792 (cherry picked from commit 53b55223d167c3fc996dd0278a656f421408ace7)
This commit is contained in:
parent
b29190c4f0
commit
d93d62371c
3 changed files with 4 additions and 7 deletions
|
@ -143,9 +143,7 @@ func serveMavenMetadata(ctx *context.Context, params parameters) {
|
||||||
ctx.Resp.Header().Set("Content-Length", strconv.Itoa(len(xmlMetadataWithHeader)))
|
ctx.Resp.Header().Set("Content-Length", strconv.Itoa(len(xmlMetadataWithHeader)))
|
||||||
ctx.Resp.Header().Set("Content-Type", contentTypeXML)
|
ctx.Resp.Header().Set("Content-Type", contentTypeXML)
|
||||||
|
|
||||||
if _, err := ctx.Resp.Write(xmlMetadataWithHeader); err != nil {
|
_, _ = ctx.Resp.Write(xmlMetadataWithHeader)
|
||||||
log.Error("write bytes failed: %v", err)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func servePackageFile(ctx *context.Context, params parameters, serveContent bool) {
|
func servePackageFile(ctx *context.Context, params parameters, serveContent bool) {
|
||||||
|
|
|
@ -234,9 +234,7 @@ func (b *Base) plainTextInternal(skip, status int, bs []byte) {
|
||||||
b.Resp.Header().Set("Content-Type", "text/plain;charset=utf-8")
|
b.Resp.Header().Set("Content-Type", "text/plain;charset=utf-8")
|
||||||
b.Resp.Header().Set("X-Content-Type-Options", "nosniff")
|
b.Resp.Header().Set("X-Content-Type-Options", "nosniff")
|
||||||
b.Resp.WriteHeader(status)
|
b.Resp.WriteHeader(status)
|
||||||
if _, err := b.Resp.Write(bs); err != nil {
|
_, _ = b.Resp.Write(bs)
|
||||||
log.ErrorWithSkip(skip, "plainTextInternal (status=%d): write bytes failed: %v", status, err)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// PlainTextBytes renders bytes as plain text
|
// PlainTextBytes renders bytes as plain text
|
||||||
|
|
|
@ -13,6 +13,7 @@ import (
|
||||||
"path"
|
"path"
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
|
"syscall"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
user_model "code.gitea.io/gitea/models/user"
|
user_model "code.gitea.io/gitea/models/user"
|
||||||
|
@ -80,7 +81,7 @@ func (ctx *Context) HTML(status int, name base.TplName) {
|
||||||
}
|
}
|
||||||
|
|
||||||
err := ctx.Render.HTML(ctx.Resp, status, string(name), ctx.Data, ctx.TemplateContext)
|
err := ctx.Render.HTML(ctx.Resp, status, string(name), ctx.Data, ctx.TemplateContext)
|
||||||
if err == nil {
|
if err == nil || errors.Is(err, syscall.EPIPE) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue