Skip to content

Commit e0633f5

Browse files
authored
Merge pull request #2 from seanmcevoy/ee-test-modifications
tweaks due to issues in EE POC
2 parents 940123f + 9b76ea4 commit e0633f5

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/webmachine_multipart.erl

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,8 @@ find_boundary(ReqData) ->
5151

5252
% @doc Turn a multipart form into component parts.
5353
% @spec get_all_parts(incoming_req_body(), boundary()) -> [fpart()]
54+
get_all_parts(Body, Boundary) when is_list(Body), is_list(Boundary) ->
55+
get_all_parts(list_to_binary(Body), Boundary);
5456
get_all_parts(Body, Boundary) when is_binary(Body), is_list(Boundary) ->
5557
StreamStruct = send_streamed_body(Body,1024),
5658
getparts1(stream_parts(StreamStruct, Boundary), []).
@@ -71,6 +73,8 @@ stream_form({Hunk, Next}, Boundary, []) ->
7173
stream_form(get_more_data(Next), Boundary, re:split(Hunk, Boundary,[]));
7274
stream_form({Hunk, Next}, Boundary, [<<>>|DQ]) ->
7375
stream_form({Hunk, Next}, Boundary, DQ);
76+
stream_form({Hunk, Next}, Boundary, [<<"\r\n">>|DQ]) ->
77+
stream_form({Hunk, Next}, Boundary, DQ);
7478
stream_form({Hunk, Next}, Boundary, [H|[T1|T2]]) ->
7579
{make_part(H), fun() ->
7680
stream_form({Hunk, Next}, Boundary, [T1|T2]) end};
@@ -94,7 +98,7 @@ stream_parts([H|T]) -> {make_part(H), fun() -> stream_parts(T) end}.
9498

9599
get_more_data(done) -> {<<"--\n">>, really_done};
96100
get_more_data(Fun) -> Fun().
97-
101+
98102
make_part(PartData) ->
99103
%% Remove the trailing \r\n
100104
[HeadData, BodyWithCRLF] = re:split(PartData, "\\r\\n\\r\\n", [{parts,2}]),

0 commit comments

Comments
 (0)