From 4e34d7d2ab579e25c35fbf79df5d07ddb3e70f53 Mon Sep 17 00:00:00 2001 From: Praful Khanduri <99384392+Horiodino@users.noreply.github.com> Date: Thu, 11 Jul 2024 22:08:28 +0530 Subject: [PATCH] fix #540 (#246) * fix #540 Signed-off-by: Horiodino * fix after review Signed-off-by: Horiodino * fxi after review Signed-off-by: Horiodino --------- Signed-off-by: Horiodino --- index/server/pkg/server/endpoint.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/index/server/pkg/server/endpoint.go b/index/server/pkg/server/endpoint.go index 6ce0a15d..215166b4 100644 --- a/index/server/pkg/server/endpoint.go +++ b/index/server/pkg/server/endpoint.go @@ -543,6 +543,12 @@ func buildIndexAPIResponse(c *gin.Context, indexType string, wantV1Index bool, p if params.Deprecated != nil { util.FilterDevfileDeprecated(&index, *params.Deprecated, wantV1Index) } + if index == nil || len(index) == 0 { + c.JSON(http.StatusOK, gin.H{ + "status": "No stacks or samples found in the registry", + }) + return + } if wantV1Index { index = util.ConvertToOldIndexFormat(index)