digitalocean / pydo

Official DigitalOcean Python Client based on the DO OpenAPIv3 specification
https://pypi.org/project/pydo/
Apache License 2.0
82 stars 13 forks source link

Error: invalid checksum digest format. #178

Open hector-medina-nubosas opened 1 year ago

hector-medina-nubosas commented 1 year ago

Hello community!

I'm using PyDO for cleaning a Container Registry in DigitalOcean so we fit under our plan without spending extra credits.

When trying to delete an image from its manifest with the delete_repository_manifest() method, I'm getting the following error:

Traceback (most recent call last): File "/...../pydo/do.py", line 36, in client.registry.delete_repository_manifest(registry, repositories[0],response['manifests'][0]['digest']) File "/...../pydo/venv/lib/python3.11/site-packages/azure/core/tracing/decorator.py", line 76, in wrapper_use_tracer return func(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^ File "/...../pydo/venv/lib/python3.11/site-packages/pydo/operations/_operations.py", line 112200, in delete_repository_manifest raise HttpResponseError(response=response) azure.core.exceptions.HttpResponseError: (None) invalid digest: invalid checksum digest format Code: None Message: invalid digest: invalid checksum digest format

I have checked the digest hash value and it's the same I'm trying to delete. According to the API docs:

The manifest digest of a container registry repository tag. https://docs.digitalocean.com/reference/api/api-reference/#operation/registry_delete_repositoryManifest

This is the first time for me to use this library, so I might be doing something wrong too.

Thanks in advance.


Update:

As an update, I have tried to use the DigitalOcean HTTP API itself to delete the resource. I could delete it without any problem with the API. I have used the same parameters I'm sending to the delete_repository_manifest(), so it's definitely a bug.

danaelhe commented 1 year ago

Hi there,

Thanks for the write up- we will investigate further on our end and give an update here when we can.

danaelhe commented 1 year ago

After investigating further, we have found that when calling: client.registry.delete_repository_manifest(registry_name="cgtest-12345", repository_name="getting-started", manifest_digest="sha256:123456")

the : in the manifest_digest arg is being url escaped to %3A: sha256%3A123456

Currently, the API endpoint does not support URL Encoding. We believe it should. We have created a ticket for our internal Container Registry Development team to add this support. We will close this issue once that support is added.

Thank you so much for bringing this to our attention.