From f4e4bf60abc44ed5258a021821ed433ccb54caef Mon Sep 17 00:00:00 2001 From: Aaron Lehmann Date: Wed, 17 May 2017 18:42:16 -0700 Subject: [PATCH] api: Only return a Platform when relevant information is available I noticed that we could return a Platform that has no information filled in. This doesn't look like it would cause any problems, but it would be confusing. Fix the handler to only append to this slice when the Platform is not empty. Signed-off-by: Aaron Lehmann Upstream-commit: df86a14af21539422f667ae33601a4f24f21e574 Component: engine --- .../api/server/router/distribution/distribution_routes.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/engine/api/server/router/distribution/distribution_routes.go b/components/engine/api/server/router/distribution/distribution_routes.go index cb98f9750d..cc9e66a166 100644 --- a/components/engine/api/server/router/distribution/distribution_routes.go +++ b/components/engine/api/server/router/distribution/distribution_routes.go @@ -122,7 +122,7 @@ func (s *distributionRouter) getDistributionInfo(ctx context.Context, w http.Res var platform v1.Platform if err == nil { err := json.Unmarshal(configJSON, &platform) - if err == nil { + if err == nil && (platform.OS != "" || platform.Architecture != "") { distributionInspect.Platforms = append(distributionInspect.Platforms, platform) } }