spring-framework icon indicating copy to clipboard operation
spring-framework copied to clipboard

Multipart messages with empty parts are not correctly parsed in WebFlux

Open KrisDaCoder opened this issue 1 year ago • 2 comments
trafficstars

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.

KrisDaCoder avatar Nov 13 '24 05:11 KrisDaCoder

Sorry for the delayed response. I've had a look at https://github.com/spring-projects/spring-framework/issues/30953 and I'm not seeing any obvious reason that would explain this behavior. The test added with that fix does contain multiple empty parts.

I tried though to reproduce it using the webTestClient in an automated test but to no avail.

Maybe you can reproduce this with a curl request, or an HTML page with a browser? In any case, we're going to need something that reproduces the problem otherwise we won't be able to find out the root of the problem.

Thanks!

bclozel avatar Jun 05 '25 12:06 bclozel

If you would like us to look at this issue, please provide the requested information. If the information is not provided within the next 7 days this issue will be closed.

spring-projects-issues avatar Jun 12 '25 12:06 spring-projects-issues

Closing due to lack of requested feedback. If you would like us to look at this issue, please provide the requested information and we will re-open the issue.

spring-projects-issues avatar Jun 19 '25 12:06 spring-projects-issues