Skip to content

Commit

Permalink
Update src/main/java/com/google/devtools/build/lib/bazel/repository/s…
Browse files Browse the repository at this point in the history
…tarlark/StarlarkBaseExternalContext.java

Co-authored-by: Fabian Meumertzheim <fabian@meumertzhe.im>
  • Loading branch information
thesayyn and fmeum committed Oct 25, 2023
1 parent 8923617 commit f4844bb
Showing 1 changed file with 4 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -225,12 +225,11 @@ private static ImmutableMap<URI, Map<String, List<String>>> getAuthHeaders(

private static ImmutableMap<URI, Map<String, List<String>>> getHeaders(
Map<String, Map<String, List<String>>> auth) throws RepositoryFunctionException, EvalException {
ImmutableMap.Builder<URI, Map<String, List<String>>> headers = new ImmutableMap.Builder<>();
for (Map.Entry<String, Map<String, List<String>>> entry : auth.entrySet()) {
ImmutableMap.Builder<URI, Map<String, List<String>>> headers =
ImmutableMap.builderWithExpectedSize(auth.size());
for (var entry : auth.entrySet()) {
try {
URL url = new URL(entry.getKey());
Map<String, List<String>> headerMap = entry.getValue();
headers.put(url.toURI(), headerMap);
headers.put(new URL(entry.getKey()).toURI(), entry.getValue());
} catch (MalformedURLException e) {
throw new RepositoryFunctionException(e, Transience.PERSISTENT);
} catch (URISyntaxException e) {
Expand Down

0 comments on commit f4844bb

Please sign in to comment.