Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

z_html: Default escape props options to empty list when none given.

Fixes crash when calling sanitizer from the escaper.
  • Loading branch information...
commit 6300a3bc1df44bbbb6368db524e9a9b4eb370f9c 1 parent 75487fa
@arjan arjan authored
Showing with 11 additions and 1 deletion.
  1. +1 −1  src/z_html.erl
  2. +10 −0 test/z_html_test.erl
View
2  src/z_html.erl
@@ -51,7 +51,7 @@
%% @doc Escape all properties used for an update statement. Only leaves the body property intact.
-spec escape_props(list()) -> list().
escape_props(Props) ->
- escape_props1(Props, [], undefined).
+ escape_props1(Props, [], []).
-spec escape_props(list(), Options::list()|context()) -> list().
escape_props(Props, Context) ->
View
10 test/z_html_test.erl
@@ -9,3 +9,13 @@ link_elements_test() ->
?assertEqual([[{"rel", "foo"}]], z_html:scrape_link_elements("<p>This is text.<link rel=\"foo\" /></p>")),
?assertEqual([[{"rel", "Foo"}]], z_html:scrape_link_elements("<p>This is text.<LINK REL=\"Foo\" /></p>")),
ok.
+
+
+escape_props_test() ->
+ ?assertEqual([{title, <<"Foo &amp; bar">>}],
+ z_html:escape_props([{title, <<"Foo & bar">>}])),
+
+ ?assertEqual([{body, <<"Foo &amp; bar">>}],
+ z_html:escape_props([{body, <<"Foo & bar">>}])),
+ ok.
+
Please sign in to comment.
Something went wrong with that request. Please try again.