We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 46b4a44 commit 8420c40Copy full SHA for 8420c40
src/hex_repo.erl
@@ -159,7 +159,9 @@ tarball_url(Config, Name, Version) ->
159
build_url(#{repo_url := URI, repo_organization := Org}, Path) when is_binary(Org) ->
160
<<URI/binary, "/repos/", Org/binary, "/", Path/binary>>;
161
build_url(#{repo_url := URI, repo_organization := undefined}, Path) ->
162
- <<URI/binary, "/", Path/binary>>.
+ <<URI/binary, "/", Path/binary>>;
163
+build_url(Config, Path) ->
164
+ build_url(Config#{repo_organization => undefined}, Path).
165
166
tarball_filename(Name, Version) ->
167
<<Name/binary, "-", Version/binary, ".tar">>.
test/hex_repo_SUITE.erl
@@ -17,7 +17,7 @@ suite() ->
17
[{require, {ssl_certs, test_pub}}].
18
19
all() ->
20
- [get_names_test, get_versions_test, get_package_test, get_tarball_test].
+ [get_names_test, get_versions_test, get_package_test, get_tarball_test, repo_org_not_set].
21
22
get_names_test(_Config) ->
23
{ok, {200, _, Packages}} = hex_repo:get_names(?CONFIG),
@@ -47,3 +47,12 @@ get_tarball_test(_Config) ->
47
48
{ok, {403, _, _}} = hex_repo:get_tarball(?CONFIG, <<"ecto">>, <<"9.9.9">>),
49
ok.
50
+
51
+repo_org_not_set(_Config) ->
52
+ Config = maps:remove(repo_organization, ?CONFIG),
53
+ {ok, {200, _, Releases}} = hex_repo:get_package(Config, <<"ecto">>),
54
+ [#{version := <<"1.0.0">>}] =
55
+ lists:filter(fun(#{version := Version}) -> Version == <<"1.0.0">> end, Releases),
56
57
+ {ok, {403, _, _}} = hex_repo:get_package(Config, <<"nonexisting">>),
58
+ ok.
0 commit comments