Merge pull request #3403 from quay/fix-npe-repo-endpoint

Fix an NPE on the repository API endpoint
This commit is contained in:
Joseph Schorr 2019-03-07 14:50:51 -05:00 committed by GitHub
commit 530c0705e9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -159,12 +159,15 @@ class PreOCIModel(RepositoryDataInterface):
tags = None tags = None
repo_ref = RepositoryReference.for_repo_obj(repo) repo_ref = RepositoryReference.for_repo_obj(repo)
if include_tags: if include_tags:
tags, _ = registry_model.list_repository_tag_history(repo_ref, page=1, size=max_tags, active_tags_only=True) tags, _ = registry_model.list_repository_tag_history(repo_ref, page=1, size=max_tags,
active_tags_only=True)
tags = [ tags = [
Tag(tag.name, tag.legacy_image.docker_image_id, tag.legacy_image.aggregate_size, Tag(tag.name,
tag.lifetime_start_ts, tag.legacy_image.docker_image_id if tag.legacy_image_if_present else None,
tag.manifest_digest, tag.legacy_image.aggregate_size if tag.legacy_image_if_present else None,
tag.lifetime_end_ts) for tag in tags tag.lifetime_start_ts,
tag.manifest_digest,
tag.lifetime_end_ts) for tag in tags
] ]
start_date = datetime.now() - timedelta(days=MAX_DAYS_IN_3_MONTHS) start_date = datetime.now() - timedelta(days=MAX_DAYS_IN_3_MONTHS)