summaryrefslogtreecommitdiff
path: root/pkg/api/handlers
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2021-09-22 18:35:48 -0400
committerGitHub <noreply@github.com>2021-09-22 18:35:48 -0400
commitc58a677f8edc36c32728a87a6ac2c48d244d7ea2 (patch)
tree9036af20111c5dfff60cf92dc930f5e528df8a2d /pkg/api/handlers
parent20587dfb7d26781aaa31b11c984f7dec8e79a282 (diff)
parent8ee18bde152da71f1b7ba9d7575324321be630d6 (diff)
downloadpodman-c58a677f8edc36c32728a87a6ac2c48d244d7ea2.tar.gz
podman-c58a677f8edc36c32728a87a6ac2c48d244d7ea2.tar.bz2
podman-c58a677f8edc36c32728a87a6ac2c48d244d7ea2.zip
Merge pull request #11705 from mheon/340
Release 3.4.0-rc2 (inc. backports)
Diffstat (limited to 'pkg/api/handlers')
-rw-r--r--pkg/api/handlers/compat/auth.go16
-rw-r--r--pkg/api/handlers/compat/images_push.go2
-rw-r--r--pkg/api/handlers/types.go3
3 files changed, 16 insertions, 5 deletions
diff --git a/pkg/api/handlers/compat/auth.go b/pkg/api/handlers/compat/auth.go
index 2244adc3d..cf53e060c 100644
--- a/pkg/api/handlers/compat/auth.go
+++ b/pkg/api/handlers/compat/auth.go
@@ -50,9 +50,19 @@ func Auth(w http.ResponseWriter, r *http.Request) {
Status: "Login Succeeded",
})
} else {
- utils.WriteResponse(w, http.StatusBadRequest, entities.AuthReport{
- IdentityToken: "",
- Status: "login attempt to " + authConfig.ServerAddress + " failed with status: " + err.Error(),
+ var msg string
+
+ var unauthErr DockerClient.ErrUnauthorizedForCredentials
+ if errors.As(err, &unauthErr) {
+ msg = "401 Unauthorized"
+ } else {
+ msg = err.Error()
+ }
+
+ utils.WriteResponse(w, http.StatusInternalServerError, struct {
+ Message string `json:"message"`
+ }{
+ Message: "login attempt to " + authConfig.ServerAddress + " failed with status: " + msg,
})
}
}
diff --git a/pkg/api/handlers/compat/images_push.go b/pkg/api/handlers/compat/images_push.go
index 07ff76819..8b6d3d56a 100644
--- a/pkg/api/handlers/compat/images_push.go
+++ b/pkg/api/handlers/compat/images_push.go
@@ -152,7 +152,7 @@ loop: // break out of for/select infinite loop
case err := <-pushErrChan:
if err != nil {
var msg string
- if errors.Cause(err) != storage.ErrImageUnknown {
+ if errors.Is(err, storage.ErrImageUnknown) {
msg = "An image does not exist locally with the tag: " + imageName
} else {
msg = err.Error()
diff --git a/pkg/api/handlers/types.go b/pkg/api/handlers/types.go
index b82c586ea..fedab3bb3 100644
--- a/pkg/api/handlers/types.go
+++ b/pkg/api/handlers/types.go
@@ -183,7 +183,8 @@ func ImageToImageSummary(l *libimage.Image) (*entities.ImageSummary, error) {
}
is := entities.ImageSummary{
- ID: l.ID(),
+ // docker adds sha256: in front of the ID
+ ID: "sha256:" + l.ID(),
ParentId: imageData.Parent,
RepoTags: imageData.RepoTags,
RepoDigests: imageData.RepoDigests,