Skip to content

Commit 6709e7a

Browse files
authored
Fix partial_pathencode to properly handle asterisk (*) (#720)
Ref: - edgurgel/httpoison#471 - #399 - #277 - #272
1 parent 870b6ad commit 6709e7a

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

src/hackney_url.erl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -461,7 +461,7 @@ partial_pathencode(<<C, Rest/binary>> = Bin, Acc) ->
461461
if C >= $0, C =< $9 -> partial_pathencode(Rest, <<Acc/binary, C>>);
462462
C >= $A, C =< $Z -> partial_pathencode(Rest, <<Acc/binary, C>>);
463463
C >= $a, C =< $z -> partial_pathencode(Rest, <<Acc/binary, C>>);
464-
C =:= $;; C =:= $=; C =:= $,; C =:= $:; C =:= $@; C =:= $(; C =:= $) ->
464+
C =:= $;; C =:= $=; C =:= $,; C =:= $:; C =:= $*; C =:= $@; C =:= $(; C =:= $) ->
465465
partial_pathencode(Rest, <<Acc/binary, C>>);
466466
C =:= $.; C =:= $-; C =:= $+; C =:= $~; C =:= $_ ->
467467
partial_pathencode(Rest, <<Acc/binary, C>>);

test/hackney_url_tests.erl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -382,7 +382,8 @@ pathencode_test_() ->
382382
{<<"/id/name:107/name2;p=1,3">>, <<"/id/name:107/name2;p=1,3">>},
383383
{<<"/@foobar">>, <<"/@foobar">>},
384384
{<<"/500x720/filters:quality(75):format(jpg)/spree/product/s/p/spree2018september12picslgzh0650.jpg">>,
385-
<<"/500x720/filters:quality(75):format(jpg)/spree/product/s/p/spree2018september12picslgzh0650.jpg">>}
385+
<<"/500x720/filters:quality(75):format(jpg)/spree/product/s/p/spree2018september12picslgzh0650.jpg">>},
386+
{<<"/1/indexes/*/queries">>, <<"/1/indexes/*/queries">>}
386387
],
387388
[{V, fun() -> R = hackney_url:pathencode(V) end} || {V, R} <- Tests].
388389

0 commit comments

Comments
 (0)