mod_mam_mnesia: Strip CDATA from form fields

Don't let mod_mam_mnesia stumble over additional whitespace when parsing
form fields.
This commit is contained in:
Holger Weiss 2015-08-15 17:58:00 +02:00
parent 92a44dfcda
commit 3e683a7621
1 changed files with 5 additions and 1 deletions

View File

@ -730,6 +730,10 @@ parse_form(#xmlel{} = Query) ->
#mam_filter{}
end;
parse_form(Fields) when is_list(Fields) ->
StripCData =
fun(#xmlel{children = Els} = Field) ->
Field#xmlel{children = xml:remove_cdata(Els)}
end,
Parse =
fun(#xmlel{name = <<"field">>,
attrs = Attrs,
@ -770,7 +774,7 @@ parse_form(Fields) when is_list(Fields) ->
?DEBUG("Got unexpected form element: ~p", [El]),
Form
end,
lists:foldl(Parse, #mam_filter{}, Fields).
lists:foldl(Parse, #mam_filter{}, lists:map(StripCData, Fields)).
-spec get_page_size_conf(binary()) -> mam_page_size_conf().