Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed parsing versions file with missing checksum #314

Merged
merged 1 commit into from
Sep 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGES/313.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fixed handling somewhat inconsistent metadata on rubygems.org where an md5 checksum is missing in the versions file.
3 changes: 3 additions & 0 deletions pulp_gem/app/tasks/synchronizing.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,9 @@ async def run(self):
info_url = urljoin(urljoin(self.remote.url, "info/"), name)
if "md5" in settings.ALLOWED_CONTENT_CHECKSUMS:
extra_kwargs = {"expected_digests": {"md5": md5_sum}}
elif md5_sum is None:
extra_kwargs = {}
log.warn(f"Checksum of info file for '{name}' was not provided.")
else:
extra_kwargs = {}
log.warn(f"Checksum of info file for '{name}' could not be validated.")
Expand Down
6 changes: 5 additions & 1 deletion pulp_gem/specs.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,11 @@ async def read_versions(relative_path):
continue
if preamble:
continue
name, versions_str, md5_sum = line.split(" ", maxsplit=2)
# Dirty trick to make the md5sum default to None
split_line = line.split(" ", maxsplit=2) + [None]
name = split_line[0]
versions_str = split_line[1]
md5_sum = split_line[2]
ext_versions = versions_str.split(",")
entry = results.get(name) or ([], "")
results[name] = (entry[0] + ext_versions, md5_sum)
Expand Down
Loading