diff options
author | Bryan Paxton <39971740+starbelly@users.noreply.github.com> | 2019-03-07 10:54:01 -0600 |
---|---|---|
committer | Tristan Sloughter <t@crashfast.com> | 2019-03-07 09:54:01 -0700 |
commit | 209c02ec57c2cc3207ee0174c3af3675b8dc8f79 (patch) | |
tree | e07b25a27a2c4cc438db75d8d066179b4e57f3f7 /src/rebar_pkg_resource.erl | |
parent | 9e2e54afd74104ecb05c55e033803f41932eb940 (diff) |
Fix fetching of private packages from orgs on hex repos (#2020)
- vendor in hex_core at v0.5.0
- Change where repo_name should be the org and not the parent
- Changed rebar_utils:url_append_path/2 to not explicitly add a '?',
this is returned in the Query chunk by http_uri:parse/1 (e.g., "?foo=bar")
- update organization_merging test to expect the sub-repo as the repo_name
- Add tests for rebar_utils:url_append_path/2
- Stop referencing/setting "organization" in config and use new
organization settings (api_repository and repo_organization)
- Do not set (assume) the read key is valid for any/every repo
- Set repo_organization and api_repository to org
- Update tests to check for new config opts
Diffstat (limited to 'src/rebar_pkg_resource.erl')
-rw-r--r-- | src/rebar_pkg_resource.erl | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/rebar_pkg_resource.erl b/src/rebar_pkg_resource.erl index 823b7fc..5de2437 100644 --- a/src/rebar_pkg_resource.erl +++ b/src/rebar_pkg_resource.erl @@ -29,7 +29,7 @@ -spec init(atom(), rebar_state:t()) -> {ok, rebar_resource_v2:resource()}. init(Type, State) -> {ok, Vsn} = application:get_key(rebar, vsn), - BaseConfig = #{http_adapter => hex_http_httpc, + BaseConfig = #{http_adapter => r3_hex_http_httpc, http_user_agent_fragment => <<"(rebar3/", (list_to_binary(Vsn))/binary, ") (httpc)">>, http_adapter_config => #{profile => rebar}}, @@ -148,7 +148,7 @@ format_error({bad_registry_checksum, Name, Vsn, Expected, Found}) -> -> {ok, cached} | {ok, binary(), binary()} | error. request(Config, Name, Version, ETag) -> Config1 = Config#{http_etag => ETag}, - try hex_repo:get_tarball(Config1, Name, Version) of + try r3_hex_repo:get_tarball(Config1, Name, Version) of {ok, {200, #{<<"etag">> := ETag1}, Tarball}} -> {ok, Tarball, ETag1}; {ok, {304, _Headers, _}} -> @@ -248,7 +248,7 @@ serve_from_cache(TmpDir, CachePath, Pkg) -> Res :: ok | {error,_} | {bad_registry_checksum, integer(), integer()}. serve_from_memory(TmpDir, Binary, {pkg, _Name, _Vsn, Hash, _RepoConfig}) -> RegistryChecksum = list_to_integer(binary_to_list(Hash), 16), - case hex_tarball:unpack(Binary, TmpDir) of + case r3_hex_tarball:unpack(Binary, TmpDir) of {ok, #{checksum := <<Checksum:256/big-unsigned>>}} when RegistryChecksum =/= Checksum -> ?DEBUG("Expected hash ~64.16.0B does not match checksum of fetched package ~64.16.0B", [RegistryChecksum, Checksum]), |