Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Drop bootstrap URI handling functions warnings #2585

Merged
merged 1 commit into from
Jun 25, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 20 additions & 18 deletions bootstrap
Original file line number Diff line number Diff line change
Expand Up @@ -747,30 +747,32 @@ chr([], _C, _I) -> 0.
%% These two functions are ports of rebar_uri module calls that
%% can't be called before the app is built; they're utility functions for
%% forwards and backwards compat so we need them to be current.
-ifdef(OTP_RELEASE).
rebar_uri_parse(URIString) ->
%% we drop rebar_uri:apply_opts since it's a noop as called here
try uri_string:parse(URIString) of
case uri_string:parse(URIString) of
Map = #{userinfo := _} -> Map;
Map when is_map(Map) -> Map#{userinfo => ""};
Res -> Res
catch
error:undef ->
%% Taken from rebar_uri and trimmed down.
case http_uri:parse(URIString, []) of
{error, Reason} ->
{error, "", Reason};
{ok, {Scheme, UserInfo, Host, Port, Path, Query}} ->
#{
scheme => atom_to_list(Scheme),
host => Host, port => Port, path => Path,
query => case Query of
[] -> "";
_ -> string:substr(Query, 2)
end,
userinfo => UserInfo
}
end
end.
-else.
rebar_uri_parse(URIString) ->
%% Taken from rebar_uri and trimmed down.
case http_uri:parse(URIString, []) of
{error, Reason} ->
{error, "", Reason};
{ok, {Scheme, UserInfo, Host, Port, Path, Query}} ->
#{
scheme => atom_to_list(Scheme),
host => Host, port => Port, path => Path,
query => case Query of
[] -> "";
_ -> string:substr(Query, 2)
end,
userinfo => UserInfo
}
end.
-endif.

%% Taken from rebar_uri.erl
rebar_uri_percent_decode(URIMap) when is_map(URIMap)->
Expand Down