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

This commit is contained in:
Luke Ma 2025-10-13 15:26:35 +08:00 committed by GitHub
parent 659342a523
commit a3aae29845
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -500,7 +500,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
}