node: fix error condition in gzipResponseWriter.init() #32896 (#1888)

This commit is contained in:
wit liu 2025-12-25 11:57:11 +08:00 committed by GitHub
parent 6a3b92b701
commit 1394ea09f0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -498,7 +498,7 @@ func (w *gzipResponseWriter) init() {
hdr := w.resp.Header()
length := hdr.Get("content-length")
if len(length) > 0 {
if n, err := strconv.ParseUint(length, 10, 64); err != nil {
if n, err := strconv.ParseUint(length, 10, 64); err == nil {
w.hasLength = true
w.contentLength = n
}