Permalink
Browse files

integer expected for block size -- add a cast

  • Loading branch information...
1 parent 951eac6 commit f3c0f09ffade4e27943ae3c635e58abdec7e9852 @rzezeski rzezeski committed with Vagabond Mar 3, 2011
Showing with 5 additions and 3 deletions.
  1. +5 −3 src/luwak_wm_file.erl
View
8 src/luwak_wm_file.erl
@@ -549,16 +549,18 @@ extract_user_meta(RD) ->
%% @doc Extract Luwak file properties from custom headers prefixed by
%% X-Luwak- in the client's request.
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) ->
Acc;
-extract_headers(RD, [{Key, Header}|T], Acc) ->
+extract_headers(RD, [{Key, Header, Cast}|T], Acc) ->
case wrq:get_req_header(Header, RD) of
undefined ->
extract_headers(RD, T, Acc);
Val ->
- extract_headers(RD, T, [{Key, Val}|Acc])
+ extract_headers(RD, T, [{Key, Cast(Val)}|Acc])
end.
%% @spec produce_doc_body(reqdata(), context()) -> {binary(), reqdata(), context()}

0 comments on commit f3c0f09

Please sign in to comment.