From 572d772a96f381b15fea576857d1e106ee94ddf2 Mon Sep 17 00:00:00 2001 From: vsedmik Date: Mon, 9 Mar 2026 12:18:07 +0100 Subject: [PATCH] Allow syncing custom repos without password When a custom repository requires upstream_username only (no password), we should be able to proceed with the username only for the base auth. Assisted By: Claude Code Closes #7425 (cherry picked from commit 2a4f88e8548096655a4954cf24698317d1e0878c) --- CHANGES/7425.bugfix | 2 ++ pulpcore/download/factory.py | 9 ++++----- 2 files changed, 6 insertions(+), 5 deletions(-) create mode 100644 CHANGES/7425.bugfix 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