diff --git a/CHANGES/7425.bugfix b/CHANGES/7425.bugfix new file mode 100644 index 00000000000..a356f7f06f8 --- /dev/null +++ b/CHANGES/7425.bugfix @@ -0,0 +1,2 @@ +Fixed a bug when syncing a custom repository using the upstream username only (no password) +did not send any authentication since both were required by the download factory. diff --git a/pulpcore/download/factory.py b/pulpcore/download/factory.py index 343d45be3f6..41f641020c9 100644 --- a/pulpcore/download/factory.py +++ b/pulpcore/download/factory.py @@ -16,7 +16,6 @@ from .http import HttpDownloader from .file import FileDownloader - PROTOCOL_MAP = { "http": HttpDownloader, "https": HttpDownloader, @@ -204,10 +203,10 @@ class to be instantiated. login=self._remote.proxy_username, password=self._remote.proxy_password ) - if self._remote.username and self._remote.password: - options["auth"] = aiohttp.BasicAuth( - login=self._remote.username, password=self._remote.password - ) + if self._remote.username: + # Support username-only auth with empty passwords + password = self._remote.password or str() + options["auth"] = aiohttp.BasicAuth(login=self._remote.username, password=password) kwargs["throttler"] = self._remote.download_throttler if self._remote.rate_limit else None