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:
parent
92a44dfcda
commit
3e683a7621
|
@ -730,6 +730,10 @@ parse_form(#xmlel{} = Query) ->
|
||||||
#mam_filter{}
|
#mam_filter{}
|
||||||
end;
|
end;
|
||||||
parse_form(Fields) when is_list(Fields) ->
|
parse_form(Fields) when is_list(Fields) ->
|
||||||
|
StripCData =
|
||||||
|
fun(#xmlel{children = Els} = Field) ->
|
||||||
|
Field#xmlel{children = xml:remove_cdata(Els)}
|
||||||
|
end,
|
||||||
Parse =
|
Parse =
|
||||||
fun(#xmlel{name = <<"field">>,
|
fun(#xmlel{name = <<"field">>,
|
||||||
attrs = Attrs,
|
attrs = Attrs,
|
||||||
|
@ -770,7 +774,7 @@ parse_form(Fields) when is_list(Fields) ->
|
||||||
?DEBUG("Got unexpected form element: ~p", [El]),
|
?DEBUG("Got unexpected form element: ~p", [El]),
|
||||||
Form
|
Form
|
||||||
end,
|
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().
|
-spec get_page_size_conf(binary()) -> mam_page_size_conf().
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue