Skip to content

Commit

Permalink
Fix partial_pathencode to properly handle asterisk (*) (#720)
Browse files Browse the repository at this point in the history
  • Loading branch information
kyleboe committed Oct 10, 2023
1 parent 870b6ad commit 6709e7a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/hackney_url.erl
Expand Up @@ -461,7 +461,7 @@ partial_pathencode(<<C, Rest/binary>> = Bin, Acc) ->
if C >= $0, C =< $9 -> partial_pathencode(Rest, <<Acc/binary, C>>);
C >= $A, C =< $Z -> partial_pathencode(Rest, <<Acc/binary, C>>);
C >= $a, C =< $z -> partial_pathencode(Rest, <<Acc/binary, C>>);
C =:= $;; C =:= $=; C =:= $,; C =:= $:; C =:= $@; C =:= $(; C =:= $) ->
C =:= $;; C =:= $=; C =:= $,; C =:= $:; C =:= $*; C =:= $@; C =:= $(; C =:= $) ->
partial_pathencode(Rest, <<Acc/binary, C>>);
C =:= $.; C =:= $-; C =:= $+; C =:= $~; C =:= $_ ->
partial_pathencode(Rest, <<Acc/binary, C>>);
Expand Down
3 changes: 2 additions & 1 deletion test/hackney_url_tests.erl
Expand Up @@ -382,7 +382,8 @@ pathencode_test_() ->
{<<"/id/name:107/name2;p=1,3">>, <<"/id/name:107/name2;p=1,3">>},
{<<"/@foobar">>, <<"/@foobar">>},
{<<"/500x720/filters:quality(75):format(jpg)/spree/product/s/p/spree2018september12picslgzh0650.jpg">>,
<<"/500x720/filters:quality(75):format(jpg)/spree/product/s/p/spree2018september12picslgzh0650.jpg">>}
<<"/500x720/filters:quality(75):format(jpg)/spree/product/s/p/spree2018september12picslgzh0650.jpg">>},
{<<"/1/indexes/*/queries">>, <<"/1/indexes/*/queries">>}
],
[{V, fun() -> R = hackney_url:pathencode(V) end} || {V, R} <- Tests].

Expand Down

0 comments on commit 6709e7a

Please sign in to comment.