From dcaa2686f40228df4eae8880a813ab07e9479434 Mon Sep 17 00:00:00 2001 From: chrislu Date: Fri, 31 Oct 2025 18:31:44 -0700 Subject: [PATCH] Added continue statements after all state transitions in the state machine to ensure immediate state processing --- weed/s3api/chunked_reader_v4.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/weed/s3api/chunked_reader_v4.go b/weed/s3api/chunked_reader_v4.go index 39d8336f0..f8f7a3ab3 100644 --- a/weed/s3api/chunked_reader_v4.go +++ b/weed/s3api/chunked_reader_v4.go @@ -256,6 +256,7 @@ func (cr *s3ChunkedReader) Read(buf []byte) (n int, err error) { return 0, cr.err } cr.state = readChunk + continue case readChunkTrailer: err = peekCRLF(cr.reader) isTrailingChunk := cr.n == 0 && cr.lastChunk @@ -283,10 +284,13 @@ func (cr *s3ChunkedReader) Read(buf []byte) (n int, err error) { // If we're using unsigned streaming upload, there is no signature to verify at each chunk. if cr.chunkSignature != "" { cr.state = verifyChunk + continue } else if cr.lastChunk { cr.state = readTrailerChunk + continue } else { cr.state = readChunkHeader + continue } case readTrailerChunk: @@ -330,6 +334,7 @@ func (cr *s3ChunkedReader) Read(buf []byte) (n int, err error) { } cr.state = eofChunk + continue case readChunk: // There is no more space left in the request buffer. @@ -404,8 +409,10 @@ func (cr *s3ChunkedReader) Read(buf []byte) (n int, err error) { cr.chunkSHA256Writer.Reset() if cr.lastChunk { cr.state = eofChunk + continue } else { cr.state = readChunkHeader + continue } case eofChunk: return n, io.EOF