daemon/c8d: Log correct error extractOCIErrors

When logging an unmarshal failure in the registry error handling code,
the function was incorrectly logging the uninitialized `derrs` variable
instead of the actual JSON unmarshal error `jerr`.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
This commit is contained in:
Paweł Gronowski
2025-12-15 15:56:44 +01:00
parent 0c01da8ccc
commit 53c67be034

View File

@@ -26,7 +26,7 @@ func translateRegistryError(ctx context.Context, err error) error {
var derr docker.Error
if errors.As(err, &remoteErr) {
if jerr := json.Unmarshal(remoteErr.Body, &derrs); jerr != nil {
log.G(ctx).WithError(derrs).Debug("unable to unmarshal registry error")
log.G(ctx).WithError(jerr).Debug("unable to unmarshal registry error")
return fmt.Errorf("%w: %w", cerrdefs.ErrUnknown, err)
}
if len(derrs) == 0 && (remoteErr.StatusCode == http.StatusUnauthorized || remoteErr.StatusCode == http.StatusForbidden) {