summaryrefslogtreecommitdiff
path: root/pkg/api/handlers
diff options
context:
space:
mode:
authorValentin Rothberg <rothberg@redhat.com>2021-12-20 17:27:02 +0100
committerValentin Rothberg <rothberg@redhat.com>2021-12-20 17:27:02 +0100
commitb1f5e861b0fa9220fbf2e95a2580892f98a803ca (patch)
treece4bb4b3b97e3d9915318b8484522d894d322ac9 /pkg/api/handlers
parent76d32a1eb9f70408b48647873f200dcceab74a2a (diff)
downloadpodman-b1f5e861b0fa9220fbf2e95a2580892f98a803ca.tar.gz
podman-b1f5e861b0fa9220fbf2e95a2580892f98a803ca.tar.bz2
podman-b1f5e861b0fa9220fbf2e95a2580892f98a803ca.zip
compat: image normalization: handle sha256 prefix
When normalizing image names on the compat API, make sure to take the `sha256:` prefix into account when matching against the image ID. Otherwise, the name will mistakingly be subject to docker.io normalization. Signed-off-by: Valentin Rothberg <rothberg@redhat.com> Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
Diffstat (limited to 'pkg/api/handlers')
-rw-r--r--pkg/api/handlers/utils/images.go2
1 files changed, 1 insertions, 1 deletions
diff --git a/pkg/api/handlers/utils/images.go b/pkg/api/handlers/utils/images.go
index d874165e3..3f3f48193 100644
--- a/pkg/api/handlers/utils/images.go
+++ b/pkg/api/handlers/utils/images.go
@@ -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
}