mirror of
https://github.com/stashapp/stash.git
synced 2025-12-17 04:14:39 +03:00
Suppress benign broken pipe and context closed warnings (#2927)
This commit is contained in:
@@ -5,11 +5,13 @@ import (
|
||||
"crypto/md5"
|
||||
"crypto/tls"
|
||||
"encoding/base64"
|
||||
"errors"
|
||||
"fmt"
|
||||
"io"
|
||||
"net/http"
|
||||
"regexp"
|
||||
"strings"
|
||||
"syscall"
|
||||
"time"
|
||||
)
|
||||
|
||||
@@ -127,5 +129,11 @@ func ServeImage(image []byte, w http.ResponseWriter, r *http.Request) error {
|
||||
w.Header().Add("Etag", etag)
|
||||
w.Header().Set("Cache-Control", "public, max-age=604800, immutable")
|
||||
_, err := w.Write(image)
|
||||
// Broken pipe errors are common when serving images and the remote
|
||||
// connection closes the connection. Filter them out of the error
|
||||
// messages, as they are benign.
|
||||
if errors.Is(err, syscall.EPIPE) {
|
||||
return nil
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user