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

Fix issue when docker image id is shorter than 12 characters #1729

Merged
merged 1 commit into from
Nov 9, 2023

Conversation

ramanan-ravi
Copy link
Collaborator

No description provided.

@ramanan-ravi ramanan-ravi merged commit d9d2a48 into main Nov 9, 2023
@ramanan-ravi ramanan-ravi deleted the image-id branch November 9, 2023 19:00
@@ -6,7 +6,13 @@ import (

func DigestToID(digest string) (string, string) {
imageID := strings.TrimPrefix(digest, "sha256:")
return imageID, imageID[:12]
var shortImageID string
if len(imageID) > 12 {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How did we arrive at this number 12 ?

@noboruma
Copy link
Collaborator

sh256 are guaranteed to be 64 characters long (when base64 encoded, 32 bytes otherwise)
Getting digest id lower than 12 bytes hints at a deeper issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants