0
Fork 0
mirror of https://github.com/ninenines/cowboy.git synced 2025-07-14 12:20:24 +00:00

Update multipart.asciidoc

For reading a multipart message where the part is a file :-
 
this line below leads to a badmap error after the last chunk has been read. So the functionality isn't affected but it just throws an error at the very end.
            `Req = case cow_multipart:form_data(Headers) of`
           
Removing the pattern matching and replacing it with just
            `case cow_multipart:form_data(Headers) of`
           
resolves the issue. Doing this means the recursive call `multipart(Req)` should be replaced with `multipart(Req1)`.
This commit is contained in:
ahron1 2022-06-06 17:15:51 +05:30 committed by GitHub
parent 2a08250499
commit d4ed99b747
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -98,14 +98,14 @@ part is a file:
multipart(Req0) -> multipart(Req0) ->
case cowboy_req:read_part(Req0) of case cowboy_req:read_part(Req0) of
{ok, Headers, Req1} -> {ok, Headers, Req1} ->
Req = case cow_multipart:form_data(Headers) of case cow_multipart:form_data(Headers) of
{data, _FieldName} -> {data, _FieldName} ->
{ok, _Body, Req2} = cowboy_req:read_part_body(Req1), {ok, _Body, Req2} = cowboy_req:read_part_body(Req1),
Req2; Req2;
{file, _FieldName, _Filename, _CType} -> {file, _FieldName, _Filename, _CType} ->
stream_file(Req1) stream_file(Req1)
end, end,
multipart(Req); multipart(Req1);
{done, Req} -> {done, Req} ->
Req Req
end. end.