25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-11-22 16:20:52 +01:00

Don't use string:take, as it isn't available in Erlang/OTP 19.3 (#3256)

This commit is contained in:
Badlop 2020-05-07 16:08:32 +02:00
parent e5a2d42484
commit edf5b3c7f0

View File

@ -494,9 +494,8 @@ get_sort_query(Q) ->
end.
get_sort_query2(Q) ->
{value, {_, String}} = lists:keysearch(<<"sort">>, 1, Q),
{StringClean, _} = string:take(String, [$/], true),
Integer = binary_to_integer(StringClean),
{value, {_, Binary}} = lists:keysearch(<<"sort">>, 1, Q),
Integer = list_to_integer(string:strip(binary_to_list(Binary), right, $/)),
case Integer >= 0 of
true -> {ok, {normal, Integer}};
false -> {ok, {reverse, abs(Integer)}}