mirror of
https://github.com/containers/podman.git
synced 2025-06-19 00:06:43 +08:00
Merge pull request #12663 from vrothberg/compat-normalization
compat: image normalization: handle sha256 prefix
This commit is contained in:
@ -35,7 +35,7 @@ func NormalizeToDockerHub(r *http.Request, nameOrID string) (string, error) {
|
||||
if errors.Cause(err) != storage.ErrImageUnknown {
|
||||
return "", fmt.Errorf("normalizing name for compat API: %v", err)
|
||||
}
|
||||
} else if strings.HasPrefix(img.ID(), nameOrID) {
|
||||
} else if strings.HasPrefix(img.ID(), strings.TrimPrefix(nameOrID, "sha256:")) {
|
||||
return img.ID(), nil
|
||||
}
|
||||
|
||||
|
@ -79,6 +79,7 @@ class TestImages(unittest.TestCase):
|
||||
# Add more images
|
||||
self.client.images.pull(constant.BB)
|
||||
self.assertEqual(len(self.client.images.list()), 2)
|
||||
self.assertEqual(len(self.client.images.list(all=True)), 2)
|
||||
|
||||
# List images with filter
|
||||
self.assertEqual(len(self.client.images.list(filters={"reference": "alpine"})), 1)
|
||||
|
Reference in New Issue
Block a user