File tree 1 file changed +5
-4
lines changed
spring-web/src/main/java/org/springframework/http/codec/multipart
1 file changed +5
-4
lines changed Original file line number Diff line number Diff line change @@ -523,7 +523,7 @@ public void onNext(DataBuffer buffer) {
523
523
if (logger .isTraceEnabled ()) {
524
524
logger .trace ("Boundary found @" + endIdx + " in " + buffer );
525
525
}
526
- int len = endIdx - this .boundaryLength + 1 ;
526
+ int len = endIdx - this .boundaryLength + 1 - boundaryBuffer . readPosition () ;
527
527
if (len > 0 ) {
528
528
// whole boundary in buffer.
529
529
// slice off the body part, and flush
@@ -538,10 +538,11 @@ else if (len < 0) {
538
538
DataBufferUtils .release (boundaryBuffer );
539
539
DataBuffer prev ;
540
540
while ((prev = this .queue .pollLast ()) != null ) {
541
- int prevLen = prev .readableByteCount () + len ;
541
+ int prevByteCount = prev .readableByteCount ();
542
+ int prevLen = prevByteCount + len ;
542
543
if (prevLen > 0 ) {
543
544
// slice body part of previous buffer, and flush it
544
- DataBuffer body = prev .split (prevLen );
545
+ DataBuffer body = prev .split (prevLen + prev . readPosition () );
545
546
DataBufferUtils .release (prev );
546
547
enqueue (body );
547
548
flush ();
@@ -550,7 +551,7 @@ else if (len < 0) {
550
551
else {
551
552
// previous buffer only contains boundary bytes
552
553
DataBufferUtils .release (prev );
553
- len += prev . readableByteCount () ;
554
+ len += prevByteCount ;
554
555
}
555
556
}
556
557
}
You can’t perform that action at this time.
0 commit comments