From fd109381362594349145749872b3dc5e358d5f21 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Gronowski?= Date: Fri, 26 Sep 2025 16:43:27 +0200 Subject: [PATCH] api/checkpoint: Don't return null if no checkpoints MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This fixes a bug where no checkpoints would produce a `null` response instead of an empty array: ``` $ docker run -d --name foo nginx:alpine 17fbeff7185733f101c38cb8208359dd0ef141116a1345da2d3c3f58c11f3e14 $ curl --unix-socket /var/run/docker.sock http://local/containers/foo/checkpoints null ``` With this patch, this becomes: ``` $ curl --unix-socket /var/run/docker.sock http://local/containers/foo/checkpoints [] ``` Signed-off-by: Paweł Gronowski (cherry picked from commit 646e068cf165ba4e6c6ac1f4179f8b13af102722) Signed-off-by: Paweł Gronowski --- api/server/router/checkpoint/checkpoint_routes.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/api/server/router/checkpoint/checkpoint_routes.go b/api/server/router/checkpoint/checkpoint_routes.go index 340fab91a4..f215102e95 100644 --- a/api/server/router/checkpoint/checkpoint_routes.go +++ b/api/server/router/checkpoint/checkpoint_routes.go @@ -38,6 +38,9 @@ func (cr *checkpointRouter) getContainerCheckpoints(ctx context.Context, w http. if err != nil { return err } + if checkpoints == nil { + checkpoints = []checkpoint.Summary{} + } return httputils.WriteJSON(w, http.StatusOK, checkpoints) }