Skip to content

Commit

Permalink
integer expected for block size -- add a cast
Browse files Browse the repository at this point in the history
  • Loading branch information
rzezeski authored and Vagabond committed Apr 18, 2011
1 parent 951eac6 commit f3c0f09
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/luwak_wm_file.erl
Expand Up @@ -549,16 +549,18 @@ extract_user_meta(RD) ->
%% @doc Extract Luwak file properties from custom headers prefixed by %% @doc Extract Luwak file properties from custom headers prefixed by
%% X-Luwak- in the client's request. %% X-Luwak- in the client's request.
extract_file_props(RD) -> extract_file_props(RD) ->
extract_headers(RD, [{block_size, ?HEAD_BLOCK_SZ}], []). extract_headers(RD,
[{block_size, ?HEAD_BLOCK_SZ, fun list_to_integer/1}],
[]).


extract_headers(_RD, [], Acc) -> extract_headers(_RD, [], Acc) ->
Acc; Acc;
extract_headers(RD, [{Key, Header}|T], Acc) -> extract_headers(RD, [{Key, Header, Cast}|T], Acc) ->
case wrq:get_req_header(Header, RD) of case wrq:get_req_header(Header, RD) of
undefined -> undefined ->
extract_headers(RD, T, Acc); extract_headers(RD, T, Acc);
Val -> Val ->
extract_headers(RD, T, [{Key, Val}|Acc]) extract_headers(RD, T, [{Key, Cast(Val)}|Acc])
end. end.


%% @spec produce_doc_body(reqdata(), context()) -> {binary(), reqdata(), context()} %% @spec produce_doc_body(reqdata(), context()) -> {binary(), reqdata(), context()}
Expand Down

0 comments on commit f3c0f09

Please sign in to comment.