Open weesftw opened 1 year ago
Same here on Micronaut 4.3.4 I have one part named "metadata" and multiple parts named "file". Even though I only send one part as "file" (for example image.jpg) I receive two parts with the same file, first part it correct, the second part is empty (InputStream is already consumed).
@Part("metadata") FileMetadata metadata,
@Part("file") Publisher<CompletedFileUpload> file
When mixing parts of different type (files and plain value) I think you should bind the body with @Body MultipartBody body
then check on each part if it's a CompletedFileUpload
or not.
This works but on my side files are limited to 1GB, I plan to open an issue for that.
Expected Behavior
When uploading multiple files using
Publisher<CompletedFileUpload>
, respond with the expected number of files and their valid bytes.Actual Behaviour
In the application created as an example that uploads multiple files using
Content-Type: multipart/form-data
, I have two parameters called 'allDocuments' and 'allPhotos' that respond to the typePublisher<CompletedFileUpload>
and another called 'photo ' which only receives a CompletedFileUpload for a single file. But also, I have additional fields such as: name (string) and age (string).First Scenario
Requesting the curl below:
And iterating the data received over a
Flux.from()
, I receive the same file more than once:and checking the integrity of the files, the first file received contains the expected bytes, the others return null/empty.
Second Scenario
Another behavior that is important to mention is when I complement the form with the 'name' parameter, the processing of
Flux.from(allDocuments)
, which is the firstblock()
of the structure, ends by reaching the stipulated timeout for no reason... just by adding the 'name' field in the request composition:having the result below:
I can't find any source that I can understand this problem... can it be considered a bug?
Steps To Reproduce
request1.sh
to reproduce first scenariorequest2.sh
to reproduce second scenariothe example files are in the project's assets folder... the scripts attached them.
Environment Information
OS: Ubuntu 22.04.3 LTS JDK Version: openjdk 17.0.7 2023-04-18
Example Application
multiple-upload-file-master.zip
Version
4.1.1