diff --git a/data/model/oci/tag.py b/data/model/oci/tag.py index 0a7706c96..bba4f766c 100644 --- a/data/model/oci/tag.py +++ b/data/model/oci/tag.py @@ -421,7 +421,7 @@ def set_tag_end_ms(tag, end_ms): .where(TagToRepositoryTag.tag == tag) .get()).repository_tag - old_style_tag.lifetime_end_ts = end_ms / 1000 + old_style_tag.lifetime_end_ts = end_ms / 1000 if end_ms is not None else None old_style_tag.save() except TagToRepositoryTag.DoesNotExist: pass diff --git a/data/model/oci/test/test_oci_tag.py b/data/model/oci/test/test_oci_tag.py index 5e1b6a2bb..c27c182df 100644 --- a/data/model/oci/test/test_oci_tag.py +++ b/data/model/oci/test/test_oci_tag.py @@ -214,6 +214,13 @@ def test_change_tag_expiration(timedelta, expected_timedelta, initialized_db): expected_ms = (updated_tag.lifetime_start_ms + offset) assert updated_tag.lifetime_end_ms == expected_ms + original_end_ms, okay = change_tag_expiration(tag, None) + assert okay + assert original_end_ms == expected_ms + + updated_tag = Tag.get(id=tag.id) + assert updated_tag.lifetime_end_ms is None + def test_set_tag_expiration_for_manifest(initialized_db): tag = Tag.get()