spring-projects / spring-framework

Spring Framework
https://spring.io/projects/spring-framework
Apache License 2.0
56.75k stars 38.15k forks source link

Multipart messages with empty parts are not correctly parsed in WebFlux #33874

Open KrisDaCoder opened 1 week ago

KrisDaCoder commented 1 week ago

In my application spring boot webflux application I have an upload use case which requires the upload of 1 and more empty files. The upload endpoint is pretty simple in itself and goes like this: public Mono<ResponseEntity<ResponseDTO>> upload(@RequestPart("files")Flux<FilePart> fileParts) { // fileParts.flatMap(filePart -> // will only contain the last empty file always if more than one empty file is uploaded) }

The problem is that if more than 1 empty files are uploaded, then only the last one is considered.

This issue started when upgrading from spring boot 2.7.18 to 3.3.5.

I saw a similar issue to this https://github.com/spring-projects/spring-framework/issues/30953 which has already been closed but I'm still having something similar. I tried though to reproduce it using the webTestClient in an automated test but to no avail. Maybe this explains https://github.com/spring-projects/spring-framework/issues/30953.