fix(authn): fix bugs in http and pgsql authn

This commit is contained in:
zhouzb 2021-09-24 17:04:20 +08:00
parent e31840d943
commit 11bdfcb8f0
2 changed files with 3 additions and 3 deletions

View File

@ -188,8 +188,8 @@ check_url(URL) ->
end. end.
check_body(Body) -> check_body(Body) ->
lists:any(fun({_, V}) -> lists:all(fun({_, V}) ->
not is_binary(V) is_binary(V)
end, maps:to_list(Body)). end, maps:to_list(Body)).
default_headers() -> default_headers() ->

View File

@ -150,7 +150,7 @@ check_password(Password,
parse_query(Query) -> parse_query(Query) ->
case re:run(Query, ?RE_PLACEHOLDER, [global, {capture, all, binary}]) of case re:run(Query, ?RE_PLACEHOLDER, [global, {capture, all, binary}]) of
{match, Captured} -> {match, Captured} ->
PlaceHolders = [PlaceHolder || PlaceHolder <- Captured], PlaceHolders = [PlaceHolder || [PlaceHolder] <- Captured],
Replacements = ["$" ++ integer_to_list(I) || I <- lists:seq(1, length(Captured))], Replacements = ["$" ++ integer_to_list(I) || I <- lists:seq(1, length(Captured))],
NQuery = lists:foldl(fun({PlaceHolder, Replacement}, Query0) -> NQuery = lists:foldl(fun({PlaceHolder, Replacement}, Query0) ->
re:replace(Query0, <<"'\\", PlaceHolder/binary, "'">>, Replacement, [{return, binary}]) re:replace(Query0, <<"'\\", PlaceHolder/binary, "'">>, Replacement, [{return, binary}])