aboutsummaryrefslogtreecommitdiff
path: root/pkg
diff options
context:
space:
mode:
authorDaniel J Walsh <dwalsh@redhat.com>2022-01-24 13:19:16 -0500
committerDaniel J Walsh <dwalsh@redhat.com>2022-01-24 13:19:16 -0500
commit80a5295d42ad875259c5fd082ee781b9e08b2c8c (patch)
tree8469e5e6335acf524836f827dd84b7864d6eda05 /pkg
parent54bfabb78a09bc50f270a81756a303e49965f253 (diff)
downloadpodman-80a5295d42ad875259c5fd082ee781b9e08b2c8c.tar.gz
podman-80a5295d42ad875259c5fd082ee781b9e08b2c8c.tar.bz2
podman-80a5295d42ad875259c5fd082ee781b9e08b2c8c.zip
Fix handling of duplicate matches on id expansion
Fixes: https://github.com/containers/podman/issues/12963 [NO NEW TESTS NEEDED] I don't know how to create two containers with the same first digit of the digest, which I could them attempt to remove. Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
Diffstat (limited to 'pkg')
-rw-r--r--pkg/api/handlers/utils/errors.go6
1 files changed, 4 insertions, 2 deletions
diff --git a/pkg/api/handlers/utils/errors.go b/pkg/api/handlers/utils/errors.go
index 919a8df1e..bf60b2c84 100644
--- a/pkg/api/handlers/utils/errors.go
+++ b/pkg/api/handlers/utils/errors.go
@@ -40,10 +40,12 @@ func VolumeNotFound(w http.ResponseWriter, name string, err error) {
}
func ContainerNotFound(w http.ResponseWriter, name string, err error) {
- if errors.Cause(err) != define.ErrNoSuchCtr {
+ switch errors.Cause(err) {
+ case define.ErrNoSuchCtr, define.ErrCtrExists:
+ Error(w, http.StatusNotFound, err)
+ default:
InternalServerError(w, err)
}
- Error(w, http.StatusNotFound, err)
}
func ImageNotFound(w http.ResponseWriter, name string, err error) {