-
Notifications
You must be signed in to change notification settings - Fork 259
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Non-octect multipart files lose their filename #662
Comments
@meztez Do you think we should preserve the file names within each group of multipart data? The ones that seem odd to me are the unnamed multipart item, such as the last two items. Ex:
|
@schloerke Maybe, yes? For your last two examples, I believe user should not expect plumber to turn garbage into gold. |
Reference: Returning Values from Forms: multipart/form-data https://tools.ietf.org/html/rfc7578 Q: Are names required?
... so no need to worry about the last two situations. Yay! Q: How should duplicate names be handled?
This makes me want to rethink our return structure. 🤔🤔 |
See also section https://tools.ietf.org/html/rfc7578#section-4.3 |
Yup! And should still not be |
Oh, I get it. Yeah, so plumber should never coalesce multipart that use the same name as you have shown above for tsv files. But would still coerce multiple files into a single named list? |
Latest #663 format Example 1 > str(req$body)
List of 5
$ files:List of 6
..$ value : raw [1:1117] 89 50 4e 47 ...
..$ content_disposition: chr "form-data"
..$ content_type : chr "image/png"
..$ name : chr "files"
..$ filename : chr "avatar2-small.png"
..$ parsed : raw [1:1117] 89 50 4e 47 ...
$ files:List of 6
..$ value : raw 61
..$ content_disposition: chr "form-data"
..$ content_type : chr "application/octet-stream"
..$ name : chr "files"
..$ filename : chr "text1.bin"
..$ parsed : raw 61
$ files:List of 6
..$ value : raw 62
..$ content_disposition: chr "form-data"
..$ content_type : chr "application/octet-stream"
..$ name : chr "files"
..$ filename : chr "text2.bin"
..$ parsed : raw 62
$ files:List of 6
..$ value : raw 63
..$ content_disposition: chr "form-data"
..$ content_type : chr "application/octet-stream"
..$ name : chr "files"
..$ filename : chr "text3.bin"
..$ parsed : raw 63
$ dt :List of 4
..$ value : raw [1:2] 7b 7d
..$ content_disposition: chr "form-data"
..$ name : chr "dt"
..$ parsed : Named list()
- attr(*, "class")= chr "plumber_multipart"
> str(req$argsBody)
List of 2
$ files:List of 4
..$ avatar2-small.png: raw [1:1117] 89 50 4e 47 ...
..$ text1.bin : raw 61
..$ text2.bin : raw 62
..$ text3.bin : raw 63
$ dt : Named list() Example 2 > str(req$body)
List of 4
$ json:List of 4
..$ value : raw [1:59] 7b 0a 20 20 ...
..$ content_disposition: chr "form-data"
..$ name : chr "json"
..$ parsed :List of 3
.. ..$ a: int 2
.. ..$ b: int 4
.. ..$ c:List of 2
.. .. ..$ w: int 3
.. .. ..$ t: int 5
$ img1:List of 6
..$ value : raw [1:1117] 89 50 4e 47 ...
..$ content_disposition: chr "form-data"
..$ content_type : chr "image/png"
..$ name : chr "img1"
..$ filename : chr "avatar2-small.png"
..$ parsed : raw [1:1117] 89 50 4e 47 ...
$ img2:List of 6
..$ value : raw [1:1537] 89 50 4e 47 ...
..$ content_disposition: chr "form-data"
..$ content_type : chr "image/png"
..$ name : chr "img2"
..$ filename : chr "ragnarok_small.png"
..$ parsed : raw [1:1537] 89 50 4e 47 ...
$ rds :List of 6
..$ value : raw [1:211] 1f 8b 08 00 ...
..$ content_disposition: chr "form-data"
..$ content_type : chr "application/rds"
..$ name : chr "rds"
..$ filename : chr "women.rds"
..$ parsed :'data.frame': 15 obs. of 2 variables:
.. ..$ height: num [1:15] 58 59 60 61 62 63 64 65 66 67 ...
.. ..$ weight: num [1:15] 115 117 120 123 126 129 132 135 139 142 ...
- attr(*, "class")= chr "plumber_multipart"
> str(req$argsBody)
List of 4
$ json:List of 3
..$ a: int 2
..$ b: int 4
..$ c:List of 2
.. ..$ w: int 3
.. ..$ t: int 5
$ img1:List of 1
..$ avatar2-small.png: raw [1:1117] 89 50 4e 47 ...
$ img2:List of 1
..$ ragnarok_small.png: raw [1:1537] 89 50 4e 47 ...
$ rds :List of 1
..$ women.rds:'data.frame': 15 obs. of 2 variables:
.. ..$ height: num [1:15] 58 59 60 61 62 63 64 65 66 67 ...
.. ..$ weight: num [1:15] 115 117 120 123 126 129 132 135 139 142 ... |
file.bin
Test Code
I would expect a nested structure like the output below to preserve the file information / separate out the chunks, rather than merge the chunks.
cc @nischalshrestha
The text was updated successfully, but these errors were encountered: