Skip to content

Commit

Permalink
Ensure basic auth when getting manifest
Browse files Browse the repository at this point in the history
Include basic auth header when getting manifest, avoiding login failure with Nexus OSS repo

Signed-off-by: amontfaucon <[email protected]>
  • Loading branch information
a186710 authored Mar 27, 2023
1 parent 5264e32 commit 0d5ae06
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions oras/provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ def _load_auth(self, hostname: str) -> bool:
elif not auth:
return False
self._basic_auth = auth
self.set_header("Authorization", "Basic %s" % self._basic_auth)
return True
return False

Expand Down Expand Up @@ -791,6 +792,7 @@ def get_manifest(
if not allowed_media_type:
allowed_media_type = [oras.defaults.default_manifest_media_type]
headers = {"Accept": ";".join(allowed_media_type)}
headers.update(self.headers)

get_manifest = f"{self.prefix}://{container.manifest_url()}" # type: ignore
response = self.do_request(get_manifest, "GET", headers=headers)
Expand Down

0 comments on commit 0d5ae06

Please sign in to comment.